0

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

我已经关注了这个链接The Lightweight User Interface Toolkit LWUIT An Introduction

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

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

2 回答 2

1

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

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

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

于 2011-02-02T12:04:51.380 回答
1

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

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

Resources r = Resources.open("/com/mycompany/somepackage/theme.res");
于 2011-02-02T19:20:04.260 回答