1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
   |  
 
package TP_ENIGME;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
 
public class Entree_MDP extends JDialog implements ActionListener {
 
  private JPanel p2;
  private JTextField TF_MDP;
  private JLabel LAB_MDP;
  private JButton b2;
  private Dimension Dim1;
 
  public Entree_MDP() {
    setTitle("Entree Nom utilisateur");
    setResizable(false); //un utilisateur ne peut pas modifier la taille
    // du Jdialog-Le JTextField garde alors les mêmes dimensions
    /*this.getContentPane().setLayout(new FlowLayout());*/
    p2 = new JPanel();
    TF_MDP = new JTextField();
    Dim1 = new Dimension(200, 20);
    TF_MDP.setPreferredSize(Dim1); //pour qu'on ne puisse pas également changer les dimensions du TextField
    LAB_MDP = new JLabel("Veuillez entrer votre nom d'utilisateur");
    b2 = new JButton("CONTINUER");
    b2.addActionListener(this);
    this.getContentPane().add(LAB_MDP, "North");
    this.getContentPane().add(TF_MDP, "Center");
    this.getContentPane().add(b2, "South");
    this.show();
 
 
     setVisible(true);
    try {
 
     	String requete = "insert Nom into Identification";
        Connection connexionSQL = Connexion_BDD.getConnexion().getConnexionSQL();
        System.out.println("la connexion est " + connexionSQL); 
        System.out.println(connexionSQL.isClosed());
        Statement stmt = connexionSQL.createStatement();
        System.out.println(requete);
        ResultSet rs = stmt.executeQuery(requete); 
 
 
     }
    catch ( Exception sqle) {System.out.println("SQL Error pendant la connection:" + sqle.getMessage());
 
    }// fin de catch
 
 
  } //fin du constructeur
 
     //connexionSQL.close();
 
 
 
  public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();
    if (source == b2) {
      BouttonAction2();
 
    }
  } // fin de méthode actionPerformed
 
  public void BouttonAction2() {
    Entree_jeu EJ1 = new Entree_jeu();
    EJ1.show();
    this.setVisible(false);
  } // fin de méthode BouttonAction2
 
  public static void main(String arg[]) {
    Entree_MDP MDP1 = new Entree_MDP();
    MDP1.pack();
    MDP1.setVisible(true);
 
  }
 
}fin de classe Entree_MDP | 
Partager