Setting the JAVA Look and Feel

The following code should be contained in the main method fo the main class.

You DO NOT need to set the look and feel of ever swing class in your project.

The look and feel in the main method provides scope accress all swing classes of the application.

Add the following import for the UI Manager.

import javax.swing.UIManager;

Add the following code at the top of the main method in the main class.
This will set the look and feel of the current platform.

try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch(Exception e) {
    System.out.println(“Error setting native LAF: ” + e);
}

Advertisements