The Java Developers Almanac 1.4


Order this book from Amazon.

   
Home > List of Packages > javax.swing  [141 examples] > Look and Feel  [4 examples]

e869. Setting the Default Look and Feel Using a System Property or Property File

By default, Swing uses a cross-platform look and feel called Metal. This default can be changed with a system property on the command line, an entry in a properties file, or programmatically (see e867 Getting and Setting a Look and Feel).

The following example demonstrates how to set the look and feel using a system property on the command line:

    > java -Dswing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel MyApp

Alternatively, the default look and feel can be set in a properties file called `swing.properties' located in the `<JAVAHOME>/lib' directory. The name of the property is swing.defaultlaf.
    # Specify the default look and feel
    swing.defaultlaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel

 Related Examples
e866. Determining the Available Look and Feels
e867. Getting and Setting a Look and Feel
e868. Getting and Setting a Native Look and Feel

See also: Actions    JButton    JCheckBox    JComboBox    JDesktop and JInternalFrame    JFrame, JWindow, JDialog    JLabel    JList    JProgressBar    JRadioButton    JScrollPane    JSlider    JSpinner    JSplitPane    JTabbedPane    JToolBar    Keystrokes and Input Maps    Layout    Menus    Progress Monitor    The Screen    Tool Tips    UI Default Values   


© 2002 Addison-Wesley.