如何使用LWUIT主题

发布于 2024-10-15 15:42:24 字数 484 浏览 4 评论 0原文

我想使用 LWUIT 来以良好的方式制作我的应用程序的 GUI。但我面临的问题是我无法使用主题。

我点击了此链接 轻量级用户界面工具包 LWUIT 简介

我使用此代码来加载主题。但这给了我例外。

try {
Resources r = Resources.open("theme.res");
UIManager.getInstance().setThemeProps(r.getTheme("theme"));
} catch (IOException ioe) {
System.out.println("Couldn't load theme.");
}

I want to use LWUIT for making GUI of my application in good way. But the problem I am facing is I am not able to use a theme.

I had followed this link The Lightweight User Interface Toolkit LWUIT An Introduction.

I had used this code to load the theme. But it is giving me exception.

try {
Resources r = Resources.open("theme.res");
UIManager.getInstance().setThemeProps(r.getTheme("theme"));
} catch (IOException ioe) {
System.out.println("Couldn't load theme.");
}

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

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

发布评论

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

评论(2

屌丝范 2024-10-22 15:42:24

ResourceEdit 文件存储在哪里?我认为你在这里犯了错误。检查您的工作空间。

将 ResourceEdit 文件存储在“src”文件夹中。

在显示任何表单之前必须调用 Display.init(this) 方法。请参阅此链接以了解您的情况参考。

Where you are stored ResourceEdit file? I think you made the mistake here. Check with your workspace.

Store the ResourceEdit file inside "src" folder.

Display.init(this) method must be called before any Form is shown. See this link for your reference.

空城之時有危險 2024-10-22 15:42:24

从代码来看,它似乎可能会抛出 FileNotFoundException

仔细检查您的 theme.res 文件应该位于默认包中。如果它在某个包中那么

Resources r = Resources.open("/com/mycompany/somepackage/theme.res");

from the code it seems it could throw FileNotFoundException

Double check your theme.res file should be in default package. if its in some package then

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