Nimbus Look and Feel
Before Applying the Nimbus Look and Feel
try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (Exception ex) { // If the nibus is not available, GUI will set to the system's look and feel UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); }
4 comments:
A picture is worth a thousand words
If you post a screenshot of your UI, like a before Nimbus and a after Nimbus view. It would help this post a lot..
sure ill upload thankx
Wow...!!! i got this simply.. Superb..
I got exception error in this codelike this
Multiple markers at this line
- Unhandled exception type
UnsupportedLookAndFeelException
- Unhandled exception type ClassNotFoundException
- Unhandled exception type InstantiationException
- Unhandled exception type IllegalAccessException
and i add catch blocks for the exceptions. Its given below:
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
} catch (Exception ex) {
// If the nibus is not available, GUI will set to the system's look and feel
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (InstantiationException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IllegalAccessException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (UnsupportedLookAndFeelException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
I think some others will also may get this error.
1000 Thanx for sharing. @Chathura Wijesinghe =D. Post some more of like this. Also try to post a topic for "How to set Round Shaped TextFields, TextArea's,etc in swing".
And one more question Can we use css styles in swing?? if yes write a post for that please.. Its may really helpfull for the beginners like me.
Thank you JEBA, actually I did not use CSS with Swing before. I'll try to write to post.
Post a Comment