Skip to main content

Resource editor

4 replies [Last post]
heziflash
Offline
Joined: 2008-06-03
Points: 0

Hi

I am trying to work with resource editor. I wrote a simple porgram:

public class HelloMidlet extends MIDlet {

public void startApp() {
Display.init(this);

//final Form f = new Form("Hello, LWUIT!");
try {
Resources r = Resources.open("/res/cig1.res");

UIManager.getInstance().setThemeProps(r.getTheme("cig1"));
} catch (IOException ioe) {
System.out.println("Couldn't load theme.");
}
//f.show();

}
}

1. the prodram is crashing
2. what code do i have to add?
3. do i have to add the dispaly.init, Form f...., and f.show ?

what is wrong?
Hezi

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
heziflash
Offline
Joined: 2008-06-03
Points: 0

Hi Chen

How do i attach files to posted messages?

Hezi

chen

lwuit-users@mobileandembedded.org wrote:
> Hi Chen
>
> How do i attach files to posted messages?
>
Not sure, you can send the files to chenf@dev.java.net .

Regards,
Chen

> Hezi
> [Message sent by forum member 'heziflash' (heziflash)]
>
> http://forums.java.net/jive/thread.jspa?messageID=279336
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net

chenf
Offline
Joined: 2008-04-29
Points: 0

Hi Hezi,
What happens is that you tried to get the theme with the "cig1" key, and in your theme the key is "Theme 2"

Try this:

try {
Resources r = Resources.open("/res/cig1.res");

UIManager.getInstance().setThemeProps(r.getTheme("[b]Theme 2[/b]"));
} catch (IOException ioe) {
System.out.println("Couldn't load theme.");
}

Regards,
Chen

chen

Hi Hezi,
The code seems right, can you print the stack trace and send it with the
cig1.res file.

Thanks,
Chen

lwuit-users@mobileandembedded.org wrote:
> Hi
>
> I am trying to work with resource editor. I wrote a simple porgram:
>
> public class HelloMidlet extends MIDlet {
>
> public void startApp() {
> Display.init(this);
>
> //final Form f = new Form("Hello, LWUIT!");
> try {
> Resources r = Resources.open("/res/cig1.res");
>
> UIManager.getInstance().setThemeProps(r.getTheme("cig1"));
> } catch (IOException ioe) {
> System.out.println("Couldn't load theme.");
> }
> //f.show();
>
>
> }
> }
>
> 1. the prodram is crashing
> 2. what code do i have to add?
> 3. do i have to add the dispaly.init, Form f...., and f.show ?
>
> what is wrong?
> Hezi
> [Message sent by forum member 'heziflash' (heziflash)]
>
> http://forums.java.net/jive/thread.jspa?messageID=279105
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net