📄 application.java
字号:
import java.awt.Dimension;
import java.awt.Toolkit;
/*
* Created on 2004-12-20
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
/**
* @author liujinghua
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class Application {
boolean packFrame = false;
/*构造函数*/
public Application() {
MainFrame frame = new MainFrame();
if (packFrame) {
frame.pack();
} else {
frame.validate();
}
//得到窗口尺寸
Dimension screenSize =
Toolkit.getDefaultToolkit().getScreenSize();
//得到框架尺寸
Dimension frameSize = frame.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
} //框架高度不得高于屏幕高度
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
} //框架宽度不得宽于屏幕宽度
//将窗口居中显示
frame.setLocation(
(screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
//显示窗口
frame.setVisible(true); //
}
/*主函数*/
public static void main(String[] args) {
new Application();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -