📄 main.java
字号:
//package MyPackage;
import java.awt.*;
import javax.swing.*;
import MyPackage.Land;
class Main{
public static boolean flag=false;
static JProgressBar progressbar;
static JWindow window;
public Main(){
window = new JWindow(); // this doesn't work
ImageIcon icon=new ImageIcon(".\\resources\\images\\"+"19.jpg");
Container container=window.getContentPane();
progressbar=new JProgressBar();
progressbar.setOrientation(JProgressBar.HORIZONTAL);
progressbar.setMinimum(0);
progressbar.setMaximum(100);
progressbar.setValue(0);
progressbar.setStringPainted(true);
progressbar.setBackground(Color.lightGray);
progressbar.setForeground(Color.gray);
progressbar.setString("正在加载Gui多人聊天程序,请稍候......");
Font font=new Font("华文新魏",Font.BOLD,30);
JLabel jl= new JLabel("欢迎您加入GUI多人聊天室",JLabel.CENTER);
jl.setFont(font);
jl.setBackground(Color.lightGray);
jl.setForeground(Color.gray);
progressbar.setPreferredSize(new Dimension(200,30));
container.setLayout(new BorderLayout());
container.add(jl, BorderLayout.NORTH );
container.add(new JLabel(icon),BorderLayout.CENTER);
container.add(progressbar, BorderLayout.SOUTH );
window.setBounds(200,100, 650, 483);
window.setVisible(true);
new progressThread().start();
}
public static void main(String args[]){
new Main();
while(true){
if(flag)
break;
}
window.setVisible(false);
new Land();
}
}
class progressThread extends Thread{
public void run(){
int i;
try{
for(i=0;i<100;i++){
Thread.sleep(100);
Main.progressbar.setValue(Main.progressbar.getValue()+1);
}
System.out.println("i="+i);
Main.flag=true;
}catch(Exception e){System.out.println("异常:"+e);}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -