943,682 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 6158
  • Java RSS
Aug 20th, 2004
0

look and feel

Expand Post »
I'm in need of determining and implementing the LookAndFeel of the operating system default within a swing frame, whatever that default may happen to be (and without using the string "com.sun.java.swing.plaf..." in the code whatsoever. When simply leaving the UIManager.setLookAndFeel() as is when creating the frame, the correct OS default doesent show up. I'm assuming that Java swing components like to have a LookAndFeel that is java default, not operating system default...
Similar Threads
Team Colleague
Reputation Points: 45
Solved Threads: 56
Unauthenticated Liar
nanosani is offline Offline
1,767 posts
since Jul 2004
Aug 22nd, 2004
0

Re: look and feel

Atlast I figured it out

"UIManager.getSystemLookAndFeelClassName()" will return the name of the default system look and feel... From there just do UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); and you're all set!
Team Colleague
Reputation Points: 45
Solved Threads: 56
Unauthenticated Liar
nanosani is offline Offline
1,767 posts
since Jul 2004
Aug 24th, 2004
0

Re: look and feel

Could you show a sample of this..I am building a menu of sorts and tried this but when compiled I recieved an exception error stating the classname has to be caught from the system to be thrown..


PanelDemo.java [71:1] unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
^
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ZEEPLE is offline Offline
15 posts
since Aug 2004
Aug 24th, 2004
0

Re: look and feel

Quote originally posted by ZEEPLE ...
PanelDemo.java [71:1] unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
^
use the try catch blocks ....
Java Syntax (Toggle Plain Text)
  1. try{
  2. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  3. }
  4. catch(ClassNotFoundExecption e){
  5. System.out.println("class not found");
  6. }

Let me know if it works.
Team Colleague
Reputation Points: 45
Solved Threads: 56
Unauthenticated Liar
nanosani is offline Offline
1,767 posts
since Jul 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: loading class dynamically
Next Thread in Java Forum Timeline: timing class





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC