Look and feel string : Look Feel « Swing JFC « Java

Look and feel string

import java.awt.BorderLayout;
import java.awt.event.KeyEvent;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.UIManager;

public class MainClass {
  final static JLabel l = new JLabel();

  public static void main(String[] args) {

    JFrame f = new JFrame();

    JPanel pane = new JPanel();
    pane.setLayout(new BorderLayout());

    JButton b = new JButton("Press Me!");
    b.setToolTipText("Click this button to see a message.");
    pane.add("North", b);

    pane.add("South", l);


    f.setSize(300, 100);

  private static void selectLookAndFeel() {
    String actualName = UIManager.getCrossPlatformLookAndFeelClassName();
    //actualName = UIManager.getSystemLookAndFeelClassName();
    //actualName = "com.sun.java.swing.plaf.mac.MacLookAndFeel";
    //actualName = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
    //actualName = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";

    try {
    } catch (Exception e) {
      System.err.println("Could not get " + actualName + " look and feel for some reason.");


Related examples in the same category

1.Getting and Setting a Native Look and Feel
2.Retrieve the cross-platform look and feel
3.Default look and feel can be set in a file called 'swing.properties' located in the '/lib' directory.
4.Getting and Setting a Look and Feel
5.Set the look and feel using a system property on the command line
6.Selecting different looks and feels
7.Change the look and feelChange the look and feel
8.A Look-and-feel switcherA Look-and-feel switcher
9.Simple look and feel Example
10.Change Look and feelChange Look and feel
11.Get Installed Look And FeelsGet Installed Look And Feels
12.Get Swing Properties
14.Highlighted ButtonHighlighted Button