📄 applicationproxy.java
字号:
package drawfigure;
import javax.swing.*;
import java.awt.*;
public class ApplicationProxy{
Application app;
Login login;
boolean started=false;
public void startApplication(){
if(started){
if(login!=null){
login.setVisible(false);
login.dispose();
System.out.println("Login has disposed.");
}else{
System.out.println("Login is null...");
}
}else{
login=new Login();
//系统在另外一个线程被加载
synchronized(this){
SwingUtilities.invokeLater(new Runnable(){
public void run(){
try{
Thread.currentThread().sleep(5000);
new Application();
started=true;
startApplication();
}catch(InterruptedException ex){
ex.printStackTrace();
}
}
});
}//end synchronized
}
}
class Login extends JWindow{
private JLabel messageLabel=new JLabel("正在启动...");
public Login(){
setSize(200,50);
getContentPane().add(messageLabel,BorderLayout.CENTER);
init();
}
public void init(){
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = this.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
this.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
this.setVisible(true);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -