📄 application1.java
字号:
package com.cdaccp;
import java.awt.Toolkit;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.Dimension;
import java.awt.Frame;
import com.cdaccp.view.frame.LoginFrm;
import java.awt.Font;
import com.cdaccp.view.frame.SystemLogImage;
import com.util.JuZhong;
public class Application1 {
boolean packFrame = false;
/**
* Construct and show the application.
*/
public Application1() {
SystemLogImage frame = new SystemLogImage();
LoginFrm loginfrm = new LoginFrm();
// Validate frames that have preset sizes
// Pack frames that have useful preferred size info, e.g. from their layout
if (packFrame) {
frame.pack();
}
else {
frame.validate();
}
// Center the window
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);
new myThread(frame, loginfrm);
}
/**
* Application entry point.
*
* @param args String[]
*/
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//设置皮服
UIManager.setLookAndFeel("soft.wes.feels.GlassThemeAlloyLookAndFeel");
//设置全局字体
Font font = new Font("宋体", Font.PLAIN, 12);
java.util.Enumeration keys = UIManager.
getLookAndFeelDefaults().
keys();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
if (UIManager.get(key) instanceof Font) {
UIManager.put(key, font);
}
}
}
catch (Exception exception) {
exception.printStackTrace();
}
new Application1();
}
});
}
//启动画面的方法
private class myThread
extends Thread {
SystemLogImage logfrm;
LoginFrm loginfrm;
myThread(SystemLogImage logfrm, LoginFrm loginfrm) {
super();
this.logfrm = logfrm;
this.loginfrm = loginfrm;
start();
}
public void run() {
try {
sleep(2000);
}
catch (InterruptedException ex) {
ex.printStackTrace();
}
logfrm.setVisible(false);
//居中显示登陆窗口
JuZhong.showFrame(loginfrm, 300, 200);
this.interrupt();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -