📄 application.java
字号:
package clinique;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.Rectangle;
public class Application extends JFrame {
JLabel lbl_picture = new JLabel();
JProgressBar pb_rute = new JProgressBar(1,200);
Timer timer;
int n = 200;
public Application() {
try {
jbInit();
} catch (Exception exception) {
exception.printStackTrace();
}
}
private void jbInit() throws Exception {
this.setTitle("欢迎进入湖人诊所系统");
getContentPane().setLayout(null);
lbl_picture.setIcon(new ImageIcon(clinique.about.class.getResource("login.jpg")));
lbl_picture.setBounds(new Rectangle(0, 0, 600, 475));
// getContentPane().add(lbl_picture(imagel));
pb_rute.setBounds(new Rectangle(46,437,500,25));
pb_rute.setStringPainted(true);
pb_rute.setString("正 在 加 载 程 序 , 请 稍 等 . . . .");
this.getContentPane().add(pb_rute);
this.getContentPane().add(lbl_picture);
this.setSize(600,500);
this.toFront();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation((screenSize.width-620)/2,(screenSize.height-540)/2 );
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
timer = new Timer(2,new AbstractAction(){
public void actionPerformed(ActionEvent e) {
if(-- n >= 0)
{
pb_rute.setValue(200-n);
timer.restart();
}else
{
timer.stop();
closeFrame();
}
}});
timer.start();
}
private void closeFrame()
{
this.dispose();
login l=new login();
l.setSize(320,230);
l.setVisible(true);
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = l.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
l.setLocation((screenSize.width - frameSize.width) / 2,
(screenSize.height - frameSize.height) / 2);
}
public static void main(String[] args)
{
Application lp = new Application();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -