Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package streaming.swing; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import streaming.entity.Pays; import streaming.service.PaysService; /** * * @author admin */ @Component public class JDialogPays extends javax.swing.JDialog { @Autowired private PaysService paysService; @Autowired private JPannelListePays jpPays; public JPannelListePays getJpPays() { return jpPays; } public void setJpPays(JPannelListePays jpPays) { this.jpPays = jpPays; } /** * Creates new form JDialogGenre */ public JDialogPays() { setModal(true); 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") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jLabel2 = new javax.swing.JLabel(); jPanel3 = new javax.swing.JPanel(); jTextField1 = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jPanel4 = new javax.swing.JPanel(); jTextNom = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jTextPrenom = new javax.swing.JTextField(); jPanel2 = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); jBAjouter = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Genre"); getContentPane().setLayout(new java.awt.GridLayout(4, 3)); jLabel2.setText("ID"); getContentPane().add(jLabel2); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup(jPanel3Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 133, Short.MAX_VALUE)); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 75, Short.MAX_VALUE)); getContentPane().add(jPanel3); jTextField1.setEditable(false); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); getContentPane().add(jTextField1); jLabel3.setText("Nom"); getContentPane().add(jLabel3); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 133, Short.MAX_VALUE)); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 75, Short.MAX_VALUE)); getContentPane().add(jPanel4); jTextNom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextNomActionPerformed(evt); } }); getContentPane().add(jTextNom); jLabel1.setText("Prenom"); getContentPane().add(jLabel1); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 133, Short.MAX_VALUE)); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 75, Short.MAX_VALUE)); getContentPane().add(jPanel1); jTextPrenom.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextPrenomActionPerformed(evt); } }); getContentPane().add(jTextPrenom); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 133, Short.MAX_VALUE)); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 75, Short.MAX_VALUE)); getContentPane().add(jPanel2); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 133, Short.MAX_VALUE)); jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 75, Short.MAX_VALUE)); getContentPane().add(jPanel5); jBAjouter.setText("Ajouter"); jBAjouter.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jBAjouterActionPerformed(evt); } }); getContentPane().add(jBAjouter); getAccessibleContext().setAccessibleName("Pays"); pack(); }// </editor-fold>//GEN-END:initComponents private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField1ActionPerformed private void jTextPrenomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextPrenomActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextPrenomActionPerformed private void jBAjouterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBAjouterActionPerformed // TODO add your handling code here: Pays p = new Pays(null, jTextNom.getText()); paysService.ajouter(p); this.jpPays.rafraichirJTable(); this.setVisible(false); }//GEN-LAST:event_jBAjouterActionPerformed private void jTextNomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextNomActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextNomActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jBAjouter; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextNom; private javax.swing.JTextField jTextPrenom; // End of variables declaration//GEN-END:variables }