jogiswinglook.java

来自「This is the complete Editor Using java」· Java 代码 · 共 29 行

JAVA
29
字号
package com.design;
import java.awt.Toolkit;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

public final class JogiSwingLook{
	private static int lookType;
	private static String lookAndFeelClassName = null;
	public static void changLookAndFeel(int lookAndfeel, JFrame frame) {
		lookType = lookAndfeel;
		UIManager.put("swing.boldMetal", Boolean.FALSE);
        JFrame.setDefaultLookAndFeelDecorated(true);
        Toolkit.getDefaultToolkit().setDynamicLayout(true);
        System.setProperty("sun.awt.noerasebackground","true");
		try{
			UIManager.LookAndFeelInfo lookAndFeels[] = UIManager.getInstalledLookAndFeels();
			lookAndFeelClassName = lookAndFeels[lookType].getClassName();
			UIManager.setLookAndFeel(lookAndFeelClassName);
			SwingUtilities.updateComponentTreeUI(frame);
		}
		catch(Exception e){
			JOptionPane.showMessageDialog(frame, "Can't change look and feel:" + lookAndFeelClassName, "Invalid PLAF", JOptionPane.ERROR_MESSAGE);
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?