?? 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 + -