用LookAndFeel调用系统主题

import javax.swing.*;
import java.awt.*;

public class JMenuTest extends JFrame {
	public JMenuTest() {
		try {
			String lookAndFeel = UIManager.getCrossPlatfromLookAndFeelClassName()
			UIManager.setLookAndFeel(lookAndFeel);
			//String lookAndFeel = UIManager.getSystemLookAndFeelClassName();调用主题系统方法
			//UIManager.setLookAndFeel(lookAndFeel);
		}catch (ClassNotFoundException ex) {
			System.out.println("ClassNotFoundException");
		}catch (InstantiationException ex) {
			System.out.println("InstantiationException");
		}catch (IllegalAccessException ex) {
			System.out.println("IllegalAccessException");
		}catch (UnsupportedLookAndFeelException ex) {
			System.out.println("UnsupportedLookAndFeelException");
		}
	}
}

你可能感兴趣的:(用LookAndFeel调用系统主题)