www.pudn.com > st.rar > FirstWindow.java, change:2007-12-17,size:1814b
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class FirstWindow extends JWindow implements ActionListener
{
JLabel back=new JLabel(new ImageIcon("first.JPG"));
JProgressBar progressBar=new JProgressBar(1,100);
Timer timer;
int n=20;
//////////////////
String sql;
Connection conn;
Statement stmt;
public FirstWindow(){
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
progressBar.setStringPainted(true);
progressBar.setString("Æô¶¯ÖС£¡£¡£");
getContentPane().add(back,"Center");
getContentPane().add(progressBar,"South");
setSize(497,399);
toFront();
Dimension screen=Toolkit.getDefaultToolkit().getScreenSize();
setLocation((screen.width-600)/2,(screen.height-600)/2);
setVisible(true);
timer=new javax.swing.Timer(100,this);
timer.addActionListener(this);
timer.start();
}
public void actionPerformed(ActionEvent e){
if(--n>0){
progressBar.setValue(100-n);
timer.restart();
}
else {
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:SUMMIT";
String user="sa";
String password="198662";
conn=DriverManager.getConnection(url,user,password);
conn.close();
}
catch(Exception ee){
JOptionPane.showMessageDialog(null,ee.getMessage());
System.exit(0);}
timer.stop();
dispose();
LoginDia LD=new LoginDia();
}
}
}