资源类无法将主题加载到我的应用程序中

发布于 2024-12-29 08:34:40 字数 592 浏览 0 评论 0原文

我创建了一个名为 Theme.res 的主题文件,并将其放置在与 .java 文件相同的文件中。 编译器似乎只是绕过了该代码段,模拟器显示与以前相同的黑白形式,没有任何应用的字体样式等。

public void startApp() {
    Display.init(this);
    try {
        System.out.println ("print");
                  Resources r = Resources.open("/Theme.res");
        System.out.println ("print");
                  UIManager.getInstance().setThemeProps(r.getTheme("myTheme"));
         System.out.println ("print");
    } 
    catch (java.io.IOException e) {
        System.err.print ("lame"); 

    } 

    Form f = new Form();

实际上只打印第一个“打印”。

提前致谢。

I created a theme file called Theme.res and placed it in the same file as the .java file.
The Compiler simply seems to bypass that segment of code and the emulator displays the same B&W form as before without any of the applied font styles etc.

public void startApp() {
    Display.init(this);
    try {
        System.out.println ("print");
                  Resources r = Resources.open("/Theme.res");
        System.out.println ("print");
                  UIManager.getInstance().setThemeProps(r.getTheme("myTheme"));
         System.out.println ("print");
    } 
    catch (java.io.IOException e) {
        System.err.print ("lame"); 

    } 

    Form f = new Form();

only the first "Print" is actually printed.

thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

追我者格杀勿论 2025-01-05 08:34:40

Theme.res放入默认包中并保留相同路径

Put the Theme.res in the default package and preserve the same path

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文