aspose file tools*
The moose likes Applets and the fly likes Applet changes from my custom lookandfeel to java default cross platform lookandfeel Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet changes from my custom lookandfeel to java default cross platform lookandfeel" Watch "Applet changes from my custom lookandfeel to java default cross platform lookandfeel" New topic
Author

Applet changes from my custom lookandfeel to java default cross platform lookandfeel

Neeteesh Singh
Greenhorn

Joined: Sep 15, 2008
Posts: 9
Hello

I am building one GUI with the help of JApplet. I have used this static block for setting the lookandfeel for the GUI. My problem is that when i hit the refresh button of the browser in IE Applet changes from my custom lookandfeel to java default cross platform lookandfeel. I tried placing the lookandfeel code in the init() method and the constructor also but no help. It would be nice if anybody can help me with this problem. My static lookandfeel code follows...


static {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (UnsupportedLookAndFeelException e) {
System.out.println("UnsupportedLookAndFeelException Occured...");
} catch (ClassNotFoundException e) {
System.out.println("ClassNotFoundException Occured...");
} catch (InstantiationException e) {
System.out.println("InstantiationException Occured...");
} catch (IllegalAccessException e) {
System.out.println("IllegalAccessException Occured...");
}
}


Thank you.


Neeteesh Singh<br />SCJP 1.4<br />SCWCD 1.4
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41820
    
  62
Welcome to JavaRanch.

For starters, don't use a constructor in applets; they should never have one.

I'm not sure if the applet lifecycle defines what exactly should happen upon page reload, but if putting the code into init doesn't work, try the start method.


Ping & DNS - my free Android networking tools app
Neeteesh Singh
Greenhorn

Joined: Sep 15, 2008
Posts: 9
Thank You Ulf for a warm Welcome.

Thank you for your reply. I also thank you for the useful tip of not using constructor in an applet. I will remember that.

I tried putting the code in the start() method also but it created few more problems. The required lookandfeel only show when I put my code in the static block, but it doesn't keep the same lookandfeel once I refresh the page and displays the java swing lookandfeel.

I am not able to find out whats going wrong. you have pointed out about the page reload. So, should I try looking for some help on that or it might be some other issue that I should look for?

Thank You.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Applet changes from my custom lookandfeel to java default cross platform lookandfeel