| | |
look and feel
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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...
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!
"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!
•
•
Join Date: Aug 2004
Posts: 15
Reputation:
Solved Threads: 0
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());
^
PanelDemo.java [71:1] unreported exception java.lang.ClassNotFoundException; must be caught or declared to be thrown
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
^
•
•
•
•
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());
^
Java Syntax (Toggle Plain Text)
try{ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(ClassNotFoundExecption e){ System.out.println("class not found"); }
Let me know if it works.
![]() |
Similar Threads
- ha ha i feel happy to interduse my self (Community Introductions)
- customizing xps look and feel? (Windows NT / 2000 / XP)
- Sometimes I feel so very (Geeks' Lounge)
- C compiler... Man I feel lame (*nix Software)
Other Threads in the Java Forum
- Previous Thread: loading class dynamically
- Next Thread: timing class
| Thread Tools | Search this Thread |
2dgraphics account android api apple applet application array arrays automation banking binary binarytree bluetooth chat chatprogramusingobjects class classes client code component data database derby design draw eclipse encryption error event exception fractal game givemetehcodez graphics gui homework html ide if_statement image input integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel jtextfield julia linux list loop map method methods midlethttpconnection mobile netbeans newbie nullpointerexception open-source oracle print printing problem program programming project property recursion reference ria scanner screen search server set size sms sort sourcelabs splash sql sqlite static stop string swing testautomation threads time tree ui unicode validation windows






