uiborder.java

来自「java开发的大整数计算器,实现基本的运算,还有sin,cos,tan,cot.」· Java 代码 · 共 71 行

JAVA
71
字号


import java.awt.Font;
import java.util.Enumeration;

import javax.swing.*;
import javax.swing.plaf.FontUIResource;

public class UIBorder
{
	public static void setSystemUI()
	{
		try
		{
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 
		}
		catch (ClassNotFoundException e)
		{
			e.printStackTrace();
		}
		catch (InstantiationException e)
		{
			e.printStackTrace();
		}
		catch (IllegalAccessException e)
		{
			e.printStackTrace();
		}
		catch (UnsupportedLookAndFeelException e)
		{
			e.printStackTrace();
		}
	}

	public static void myUI()
	{
		try
		{   
			  
		    UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");   
		  
		}
		catch (Exception ex)
		{   
		  
		    ex.printStackTrace();   
		  
		}  

		initGlobalFontSetting("新细明", 12); 
	}


	public static void initGlobalFontSetting(String font, int size)
	{ 
		for (Enumeration keys = UIManager.getDefaults().keys(); 
		keys.hasMoreElements(); )
		{ 
			Object key = keys.nextElement(); 
			Object value = UIManager.get(key); 

			if (value instanceof FontUIResource)
			{ 
				FontUIResource rs = (FontUIResource) value; 
				Font fontRes = new Font(font, rs.getStyle() , size); 
				UIManager.put(key, new FontUIResource(fontRes)); 
			} 
		} 
	}

}

⌨️ 快捷键说明

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