📄 win.java
字号:
import javax.swing.*;
import java.awt.*;
import java.net.*;
public class Win extends JWindow implements Runnable {
Thread splashThread;
JProgressBar progress;
public Win() {
Container container=getContentPane();
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
URL url = getClass().getResource("ee.jpg");
if(url!=null){
container.add(new JLabel(new ImageIcon(url)),BorderLayout.CENTER);
}
progress=new JProgressBar(1,100);
progress.setStringPainted(true);
progress.setString("正在加载磁盘......");
progress.setBackground(Color.red);
container.add(progress,BorderLayout.SOUTH);
Dimension screen=getToolkit().getScreenSize();
pack();
setLocation((screen.width-getSize().width)/2,(screen.height-getSize().height)/2);
}
public void start(){
this.toFront();
splashThread=new Thread(this);
splashThread.start();
}
public void run(){
setVisible(true);
try{
for(int i=0;i<100;i++){
Thread.sleep(100);
progress.setValue(progress.getValue()+1);
if(i==33){
progress.setString("正在加载CPU......");
progress.setBackground(Color.yellow);}
if(i==66){
progress.setString("正在加载图形界面......");
progress.setBackground(Color.green);
}
}
}
catch (Exception ex){ex.printStackTrace();}
dispose();
showFrame();
}
static void showFrame(){
new clock();
new OS();
}
public static void main (String[] args) {
Win splash=new Win();
splash.start();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -