Home > database >  For years, teaching of new
For years, teaching of new

Time:09-26

Do a login interface,
Package jiemian;
The import dashiyan. Denglu;
Import the Java. SQL. Connection;
Import the Java. SQL. The ResultSet;
Import the Java. SQL. SQLException;
Import Java, SQL Statement;
import java.util.Vector;
The import javax.mail. Swing. JOptionPane;
The import lianjie. Lianjiejiekou;
The import static lianjie. Lianjieshujuku. JavaCon;
/* *
*
* @ author Administrator
*/
Public class jiemian extends javax.mail. Swing. JFrame {

/* *
* Creates new form jiemian
*/
Public jiemian () {
InitComponents ();
}

/* *
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@ SuppressWarnings (" unchecked ")
//& lt; Editor - a fold defaultstate="collapsed" desc="Generated Code" & gt;
Private void initComponents () {

Id=new javax.mail. Swing. JTextField ();
JLabel1=new javax.mail. Swing. JLabel ();
JLabel2=new javax.mail. Swing. JLabel ();
Mima=new javax.mail. Swing. JTextField ();
JButton1=new javax.mail. Swing. JButton ();

SetDefaultCloseOperation (javax.mail. Swing. WindowConstants. EXIT_ON_CLOSE);

Id. AddActionListener (new Java. The awt. Event. The ActionListener () {
Public void actionPerformed (Java awt. Event. An ActionEvent evt) {
IdActionPerformed (evt).
}
});

JLabel1. SetText (" login name ");

JLabel2. SetText (" password ");

JButton1. SetText (" login ");
JButton1. AddActionListener (new Java. The awt. Event. The ActionListener () {
Public void actionPerformed (Java awt. Event. An ActionEvent evt) {
JButton1ActionPerformed (evt).
}
});

Javax.mail. Swing. GroupLayout layout=new javax.mail. Swing. GroupLayout (getContentPane ());
GetContentPane (). SetLayout (layout);
Layout. SetHorizontalGroup (
Layout. CreateParallelGroup (javax.mail. Swing. GroupLayout. Alignment. LEADING)
AddGroup (javax.mail. Swing. GroupLayout. Alignment. The TRAILING, layout, createSequentialGroup ()
AddContainerGap (javax.mail. Swing. GroupLayout. DEFAULT_SIZE, Short. MAX_VALUE)
AddComponent (jButton1)
. AddGap (22, 22, 22))
AddGroup (layout. CreateSequentialGroup ()
AddGap (22, 22, 22)
AddGroup (layout. CreateParallelGroup (javax.mail. Swing. GroupLayout. Alignment. LEADING, false)
AddGroup (layout. CreateSequentialGroup ()
AddComponent (jLabel1)
AddPreferredGap (javax.swing.LayoutStyle.Com ponentPlacement. UNRELATED)
AddComponent (id, javax.mail. Swing. GroupLayout. PREFERRED_SIZE, 71, javax.mail. Swing. GroupLayout. PREFERRED_SIZE))
AddGroup (layout. CreateSequentialGroup ()
AddComponent (jLabel2)
AddPreferredGap (javax.swing.LayoutStyle.Com ponentPlacement. UNRELATED)
AddComponent (mima)))
. AddContainerGap (261, Short. MAX_VALUE))
);
Layout. SetVerticalGroup (
Layout. CreateParallelGroup (javax.mail. Swing. GroupLayout. Alignment. LEADING)
AddGroup (layout. CreateSequentialGroup ()
AddGap (74, 74, 74)
AddGroup (layout. CreateParallelGroup (javax.mail. Swing. GroupLayout. Alignment. The BASELINE)
AddComponent (jLabel1)
AddComponent (id, javax.mail. Swing. GroupLayout. PREFERRED_SIZE, javax.mail. Swing. GroupLayout. DEFAULT_SIZE, javax.mail. Swing. GroupLayout. PREFERRED_SIZE))
AddPreferredGap (javax.swing.LayoutStyle.Com ponentPlacement. RELATED, 70, Short. MAX_VALUE)
AddGroup (layout. CreateParallelGroup (javax.mail. Swing. GroupLayout. Alignment. The BASELINE)
AddComponent (jLabel2)
AddComponent (mima, javax.mail. Swing. GroupLayout. PREFERRED_SIZE, javax.mail. Swing. GroupLayout. DEFAULT_SIZE, javax.mail. Swing. GroupLayout. PREFERRED_SIZE))
AddGap (68, 68, 68)
AddComponent (jButton1)
. AddGap (23, 23, 23))
);

Pack ();
}//& lt;/editor - fold>

Private void idActionPerformed (Java awt. Event. An ActionEvent evt) {
//TODO the add your handling code here:
}

Private void jButton1ActionPerformed (Java awt. Event. An ActionEvent evt) {
Denglu Denglu=new Denglu ();
Denglu. Setmima (enclosing mima. GetText ());
Denglu. Setid (this. Id. GetText ());
The Connection conn=JavaCon ();
The Vector data=https://bbs.csdn.net/topics/new Vector ();
Int a1=0;
Try {
The Statement STMT=conn. CreateStatement ();
The ResultSet rs=STMT. ExecuteQuery (" select * from [user] where id="+ id + mima" mima="+ +";" );
If (rs==null) {
JOptionPane. ShowMessageDialog (null, "error account password, please enter again", "warning", JOptionPane. INFORMATION_MESSAGE);
}
The else {
A1=1;
}
rs.close();
stmt.close();
conn.close();
{} the catch (SQLException ex3)
Ex3. PrintStackTrace ();
}
If (a1==1) {
New yemian (.) setVisible (true);
}






}

/* *
* @ param args the command line arguments
*/
Public static void main (String args []) {
/* Set the Nimbus look and feel */
//& lt; nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related