This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Neeteesh Singh
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Neeteesh Singh
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic