Monday, December 14, 2009

Java Look and Feel

We can modify the look and feel of java GUI components,Here is an example used to implement the look and feel concepts in java programs.

Using below code we can set the operating systems look and feel.

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

import javax.swing.SwingUtilities;
import javax.swing.UIManager;

public class LookAndFeel {
    public static void main(String[] args) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            // UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createTheGUIComponents();
            }

            private void createTheGUIComponents() {
                // Your implementation here…
            }
        });
    }
}

We can also set the lot of GUI skins using substance.jar.

Download the latest substance.jar using below link

http://weblogs.java.net/blog/2005/12/29/swinging-java-ides

Add the above jar file in java classpath.

0 Comments:

Post a Comment

The Link Exchange - Your ultimate resource for link exchange!

About This Blog

  © Blogger template Webnolia by Ourblogtemplates.com 2009

Back to TOP