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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
| private JTextField getJTextField_code_paiement_famclients() {
if (jTextField_code_paiement_famclients == null) {
jTextField_code_paiement_famclients = new JTextField();
jTextField_code_paiement_famclients.setBounds(new Rectangle(89, 11, 153, 24));
jTextField_code_paiement_famclients.getText();
}
return jTextField_code_paiement_famclients;
}
/**
* This method initializes jTextField_designation_paiement_famclients
*
* @return javax.swing.JTextField
*/
private JTextField getJTextField_designation_paiement_famclients() {
if (jTextField_designation_paiement_famclients == null) {
jTextField_designation_paiement_famclients = new JTextField();
jTextField_designation_paiement_famclients.setBounds(new Rectangle(89, 41, 153, 24));
jTextField_designation_paiement_famclients.getText();
}
return jTextField_designation_paiement_famclients;
}
/**
* This method initializes jButton_ajouter_paiement_famclients
*
* @return javax.swing.JButton
*/
/**
* This method initializes jButton_suppr_paiement_famclients
*
* @return javax.swing.JButton
*/
private JButton getJButton_suppr_paiement_famclients() {
if (jButton_suppr_paiement_famclients == null) {
jButton_suppr_paiement_famclients = new JButton();
jButton_suppr_paiement_famclients.setBounds(new Rectangle(148, 109, 94, 21));
jButton_suppr_paiement_famclients.setText("Supprimer");
}
return jButton_suppr_paiement_famclients;
}
/**
* This method initializes jComboBox_mdp_client
*
* @return javax.swing.JComboBox
*/
private JComboBox getJComboBox_mdp_client() {
if (jComboBox_mdp_client == null) {
jComboBox_mdp_client = new JComboBox();
jComboBox_mdp_client.setBounds(new Rectangle(14, 80, 123, 23));
jComboBox_mdp_client.setEditable(true);
}
return jComboBox_mdp_client;
}
/**
* This method initializes jButton_ajouter_famclients
*
* @return javax.swing.JButton
*/
private JButton getJButton_ajouter_famclients() {
if (jButton_ajouter_famclients == null) {
jButton_ajouter_famclients = new JButton();
jButton_ajouter_famclients.setBounds(new Rectangle(148, 80, 92, 24));
jButton_ajouter_famclients.setText("Ajouter");
jButton_ajouter_famclients.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e){
{
Statement instruction = null;
Connection connexion = null;
ResultSet resultat = null;
try
{
Class.forName("com.mysql.jdbc.Driver");
connexion = DriverManager.getConnection("jdbc:mysql://localhost/gescom2","root","");
instruction = connexion.createStatement();
if ((jTextField_code_paiement_famclients.getText() != " ") && (jTextField_designation_paiement_famclients.getText() != " "))
{
instruction.executeUpdate("INSERT INTO mode_de_paiement(code_mdp,lib_mdp) VALUES("+jTextField_code_paiement_famclients.getText()+","+jTextField_designation_paiement_famclients.getText()+")");
}
else {
JOptionPane.showMessageDialog(null,"Attention, veuillez remplir le code ET la désignation");
}
}
catch (ClassNotFoundException ex)
{
JOptionPane.showMessageDialog(null,"Classe introuvable" + ex.getMessage());
}
catch (SQLException ex)
{
JOptionPane.showMessageDialog(null, "Connexion impossible:" + ex.getMessage());
}
finally
{
try
{
if(connexion !=null)
connexion.close();
if(instruction !=null)
instruction.close();
if (connexion !=null)
connexion.close();
}
catch (SQLException ex)
{
ex.printStackTrace();
}
}
}
}
});
}
return jButton_ajouter_famclients;
}
} |
Partager