📄 processbarframe.java
字号:
/**
* <p>Title: 卓博营运支撑系统</p>
*
* <p>Description: 为本企业内部运作提供支撑,为企业資源的E化管理提供解決方案</p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: 卓博信息科技有限公司</p>
*
* @author Henry
* @version 1.0
*/
package com.jobcn.ui;
import java.awt.Color;
import java.awt.Cursor;
import javax.swing.*;
import com.jobcn.control.Constant;
/** ProcessBarFrame.java
* function: 进度引导程序,通过它启动主程序。
* describe:
*/
public class ProcessBarFrame extends JFrame {
public ProcessBarFrame() {
this("进入系统");
startThread();
}
private void startThread() {
new Thread() {
public void run() {
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
runProcess();
}
}.start();
new Thread() {
public void run() {
setProcess();
}
}.start();
new Thread() {
public void run() {
new MainFrame();
dispose();
}
}.start();
}
/**
* Create the frame
*/
public ProcessBarFrame(String title) {
super(title);
setIconImage(((ImageIcon) Constant.systemIcon).getImage());
setUndecorated(true);
setBounds(0, 0, 350, 35);
setLocationRelativeTo(null);
progressBar = new JProgressBar(0, lengthOfTask);
progressBar.setBackground(Color.WHITE);
//progressBar.setFont(new Font("", Font.BOLD|Font.ITALIC, 14));
progressBar.setForeground(new Color(0x336699));
progressBar.setString("正在进入任务管理系统。。。");
progressBar.setValue(0);
progressBar.setStringPainted(true);
getContentPane().add(progressBar);
setVisible(true);
}
private void runProcess() {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
while (!done) {
try {
Thread.sleep(5);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
current++;
if (current >= lengthOfTask+1) {
done = true;
}
}
}
private void setProcess() {
while (!done) {
try {
Thread.sleep(10);
} catch (InterruptedException e1) {
e1.printStackTrace();
}
progressBar.setValue(current);
if (current >= lengthOfTask+1) {
done = true;
}
}
}
/**
* Launch the application
* @param args
*/
public static void main(String args[]) {
new ProcessBarFrame();
}
private JProgressBar progressBar;
private boolean done = false;
private int current = 0;
private int lengthOfTask = 75;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -