The 'default' look and feel
by, 04-26-2012 at 08:41 PM (751 Views)
Methods are provided by UIManager to set or get the current, default Look & feel.
Being default look & feel, cross platformed look and feel of Java which is called “Metal” is initialized by the Swing. But if default look & feel needs to be set by the Swing program explicitly, then this could be done by UIManager.setLookAndFeel() method. For instance, given sample of code sets the default Look & Feel, to be Motif/CDE:Java Code:public static LookAndFeel getLookAndFeel() public static void setLookAndFeel(LookAndFeel newLookAndFeel) public static void setLookAndFeel(String className)
Following static method is provided by UIManager to obtain the proper LookAndFeel classnames programmatically for these case:Java Code:UIManager.setLookAndFeel( "com.sun.java.swing.plaf.motif.MotifLookAndFeel");
To make it sure that always program run in the system of platform look & feel, code shall be:Java Code:public static String getSystemLookAndFeelClassName() public static String getCrossPlatformLookAndFeelClassName()
Java Code:UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName());