Search code examples
javajava-melwuit

How to use LWUIT 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.");
}

Solution

  • 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.