📄 client.java
字号:
package client;
/*
* 创建日期 2006-6-5
* 作者: 褚廷军
* 项目名称:学生考试系统;
* 项目要求:毕业设计;
* 模块名称:客户端欢迎界面
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Client extends JWindow implements ActionListener
{
/**
*
*/
private static final long serialVersionUID = 688218996681867439L;
JLabel label;
Icon icon;
Timer timer1,timer2;
JProgressBar progress;
int i=0,n=0,j=0;
String s="欢迎使用网络考试系统";
public Client()
{
icon=new ImageIcon("welcome.jpg");
label=new JLabel(icon,JLabel.CENTER);
label.setFont(new Font("隶书",Font.BOLD,86));
label.setHorizontalTextPosition(JLabel.CENTER);
label.setVerticalTextPosition(JLabel.CENTER);
timer1=new Timer(20,this);
timer2=new Timer(130,this);
progress = new JProgressBar(1,150);
progress.setStringPainted(true);
progress.setBorderPainted(false);
progress.setFont(new Font("隶书",Font.BOLD,36));
progress.setString("考试系统正在加载,请稍后...");
progress.setBackground(Color.white);
timer1.start();
timer2.start();
Container con=getContentPane();
con.add(label,BorderLayout.CENTER);
con.add(progress,BorderLayout.SOUTH);
//setBounds(0,0,1025,750);
this.setSize(1024,730);
setVisible(true);
validate();
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==timer1)
{
i=i+1;
j=(j+2)%360;
Color color=new Color((3*i)%255,(7*i)%255,(11*i)%255);
label.setForeground(color);
progress.setValue(progress.getValue() + 1);
if(i>=150)
{
JFrame.setDefaultLookAndFeelDecorated(true);
new TestGui();
this.dispose();
timer1.stop();
timer2.stop();
}
}
if(e.getSource()==timer2)
{
if(n<12)
{
label.setText(s.substring(0,n));
if(n==10)
n=0;
}
n++;
}
}//
public static void main(String args[])
{
new Client();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -