?? mainwindow.java
字號:
package bookmanage;
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
/**
* <p>Title: 圖書管理系統(tǒng)</p>
*
* <p>Description: MianWindow類是繼承JWindow,實現(xiàn)接口ActionListener,主要是是用來
* 啟動軟件的界面</p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: 浙江工業(yè)大學信息學院計算機系</p>
*
* @author 曾文秋
* @version 1.0
*/
public class MainWindow
extends JWindow implements ActionListener {
JLabel back=new JLabel(new ImageIcon("image/tree.jpg"));//顯示圖形的標簽
JProgressBar progressBar=new JProgressBar(1,100);//進度條
Timer timer;//時間組件
int n=100;
public MainWindow(){
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));//設(shè)置鼠標的形狀
progressBar.setStringPainted(true); //允許進度條顯示文本
progressBar.setString("正在加載程序.......");//設(shè)置進度條文本
this.getContentPane().add(back,BorderLayout.CENTER);
this.getContentPane().add(progressBar,BorderLayout.SOUTH);
this.setSize(800,552);//設(shè)置大小
this.toFront();//界面移到最前
this.setLocation(100,100);//設(shè)置位置
this.setVisible(true);//設(shè)置為可顯示
timer=new Timer(10,this);//建立時間組件
timer.addActionListener(this);//注冊事件監(jiān)聽器
timer.start();
}
/**
*
* 事件處理程序,timer每隔10毫秒觸發(fā)此事件
*
* @param e ActionEvent 傳入一個事件
*/
public void actionPerformed(ActionEvent e) {
if(--n>0){
progressBar.setValue(100-n);//設(shè)置進度條的值
timer.restart(); //重新啟動時間組件
}
else {
timer.stop();//停止計時
dispose(); //銷毀窗口
InputIp IpAdress=new InputIp();
IpAdress.setLocation(300,200);
IpAdress.setSize(400,250);
IpAdress.setVisible(true);
}
}
/**
*主函數(shù),程序的入口地址
*
* @param args String[]
*/
public static void main(String [] args){
//System.setProperty("Quaqua.tabLayoutPolicy","wrap");
try{
UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");
//UIManager.setLookAndFeel("ch.randelshofer.quaqua.QuaquaLookAndFeel");
}catch(Exception e){
e.printStackTrace();
}
MainWindow splashwindow=new MainWindow();//創(chuàng)建對象
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -