Graphical User Interface: Layout, Look and Feel, Introduction To Eventhandling
Graphical User Interface: Layout, Look and Feel, Introduction To Eventhandling
UIManager.setLookAndFeel(UIManager.getSys
temLookAndFeelClassName());
//where name of look and feel is highlighted
}
catch (Exception e) {
e.printStackTrace();}
Built in Look and Feel
• UIManager.getCrossPlatformLookAndFeelClassName()
– Returns the look and feel that works on all platforms — the Java look and feel also
called metal.
• UIManager.getSystemLookAndFeelClassName()
– Specifies the look and feel for the current platform.
• "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
– Specifies the GTK+ look and feel
• "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"
– Specifies the Windows look and feel.
• "com.sun.java.swing.plaf.motif.MotifLookAndFeel"
– This look and feel can be used on any platform.
• Note: The GTK+ L&F will only run on UNIX or Linux systems with GTK+ 2.2 or later
installed, while the Windows L&F runs only on Windows systems. Like the Java (Metal)
L&F, the Motif L&F will run on any platform.
Third party look and feel
• Add package.
– Download the .jar file
– Go to project properties by right clicking on project.
– Then click on Libraries tab, You will see Compile, Run, Compile
Tests, Run Tests tabs.
– Click on Compile tab (the first tab, selected by default)
– Click on Add JAR/Folder button at right
– Then browse and select the jar file(not the folder) you want to
include. Included jar file will show on the following box of Compile
tab.
– Click on OK button.
– Finished.
Event Handling