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 com.uquetignyadminapp.visual; import com.mongodb.BasicDBObject; import com.mongodb.DB; import com.mongodb.DBCollection; import com.uquetignyadminapp.connection.ConnectionMongoDB; import java.net.UnknownHostException; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Boudabza */ public class Admin_NewTable extends javax.swing.JFrame { /** * Creates new form Admin_NewTable */ int cpt = 0; public Admin_NewTable() throws UnknownHostException { initComponents(); setTitle("ULQ Manager"); jComboBox2.setVisible(false); jComboBox3.setVisible(false); jComboBox4.setVisible(false); jComboBox5.setVisible(false); jComboBox6.setVisible(false); jComboBox7.setVisible(false); jComboBox8.setVisible(false); jLabel3.setVisible(false); jLabel4.setVisible(false); jLabel5.setVisible(false); jLabel6.setVisible(false); jLabel7.setVisible(false); jLabel8.setVisible(false); jLabel9.setVisible(false); jTextField3.setVisible(false); jTextField4.setVisible(false); jTextField5.setVisible(false); jTextField6.setVisible(false); jTextField7.setVisible(false); jTextField8.setVisible(false); jTextField9.setVisible(false); jTextField11.setVisible(false); jTextField12.setVisible(false); jTextField13.setVisible(false); jTextField14.setVisible(false); jTextField15.setVisible(false); jTextField16.setVisible(false); jTextField17.setVisible(false); } /** * 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() { jPanel1 = new javax.swing.JPanel(); jButton2 = new javax.swing.JButton(); jTextField14 = new javax.swing.JTextField(); jTextField15 = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); jTextField12 = new javax.swing.JTextField(); jComboBox4 = new javax.swing.JComboBox(); jTextField13 = new javax.swing.JTextField(); jTextField5 = new javax.swing.JTextField(); jTextField10 = new javax.swing.JTextField(); jTextField11 = new javax.swing.JTextField(); jTextField16 = new javax.swing.JTextField(); jTextField17 = new javax.swing.JTextField(); jLabel7 = new javax.swing.JLabel(); a = new javax.swing.JTextField(); jTextField7 = new javax.swing.JTextField(); b = new javax.swing.JLabel(); jTextField6 = new javax.swing.JTextField(); jComboBox5 = new javax.swing.JComboBox(); jComboBox6 = new javax.swing.JComboBox(); jComboBox8 = new javax.swing.JComboBox(); jLabel2 = new javax.swing.JLabel(); jComboBox7 = new javax.swing.JComboBox(); jButton1 = new javax.swing.JButton(); jTextField9 = new javax.swing.JTextField(); jTextField2 = new javax.swing.JTextField(); jTextField8 = new javax.swing.JTextField(); jComboBox1 = new javax.swing.JComboBox(); jLabel9 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jTextField3 = new javax.swing.JTextField(); jComboBox2 = new javax.swing.JComboBox(); jLabel4 = new javax.swing.JLabel(); jTextField4 = new javax.swing.JTextField(); jComboBox3 = new javax.swing.JComboBox(); jLabel5 = new javax.swing.JLabel(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); jMenuItem2 = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setForeground(new java.awt.Color(255, 255, 204)); jPanel1.setBackground(new java.awt.Color(255, 255, 204)); jButton2.setText("Confirmer"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jTextField14.setMinimumSize(new java.awt.Dimension(20, 20)); jTextField15.setMinimumSize(new java.awt.Dimension(20, 20)); jLabel6.setText("Nom Champ :"); jTextField12.setMinimumSize(new java.awt.Dimension(20, 20)); jComboBox4.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Varchar", "Integer" })); jTextField13.setMinimumSize(new java.awt.Dimension(20, 20)); jTextField10.setMinimumSize(new java.awt.Dimension(20, 20)); jTextField10.setName(""); // NOI18N jTextField11.setMinimumSize(new java.awt.Dimension(20, 20)); jTextField16.setMinimumSize(new java.awt.Dimension(20, 20)); jTextField17.setMinimumSize(new java.awt.Dimension(20, 20)); jLabel7.setText("Nom Champ :"); b.setText("Nom de la table :"); jComboBox5.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Varchar", "Integer" })); jComboBox6.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Varchar", "Integer" })); jComboBox8.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Varchar", "Integer" })); jLabel2.setText("Nom Champ :"); jComboBox7.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Varchar", "Integer" })); jButton1.setBackground(new java.awt.Color(255, 0, 0)); jButton1.setText("+"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Varchar", "Integer" })); jLabel9.setText("Nom Champ :"); jLabel8.setText("Nom Champ :"); jLabel3.setText("Nom Champ :"); jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Varchar", "Integer" })); jLabel4.setText("Nom Champ :"); jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Varchar", "Integer" })); jLabel5.setText("Nom Champ :"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(51, 51, 51) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addComponent(b).addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addComponent(jLabel5) .addGap(18, 18, 18).addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup().addComponent(jLabel4) .addGap(18, 18, 18).addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup().addComponent(jLabel2) .addGap(18, 18, 18).addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup().addComponent(jLabel3) .addGap(18, 18, 18).addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup().addComponent(jLabel9) .addGap(18, 18, 18).addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup().addComponent(jLabel6) .addGap(18, 18, 18).addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7).addComponent(jLabel8)).addGap(18, 18, 18) .addGroup(jPanel1Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addGap(26, 26, 26) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(112, 112, 112) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(a) .addComponent(jTextField17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField16, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 172, Short.MAX_VALUE))) .addGap(131, 131, 131)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton1).addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(134, 134, 134))); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(a, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(b)) .addGap(27, 27, 27) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2).addComponent(jTextField2) .addComponent(jComboBox1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4).addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5).addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6).addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7).addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(13, 13, 13) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel8)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9) .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( jComboBox8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(65, 65, 65)) .addGroup(jPanel1Layout.createSequentialGroup().addGap(47, 47, 47) .addComponent(jTextField10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jTextField11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jComboBox3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jComboBox5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jComboBox6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent( jTextField15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup().addGap(11, 11, 11) .addComponent(jTextField16, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jTextField17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup().addGap(9, 9, 9) .addComponent(jComboBox7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(34, 34, 34)))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup().addGap(105, 105, 105).addComponent(jButton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); jMenu1.setText("Fichier"); jMenuItem1.setText("Retour"); jMenuItem1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); jMenu1.add(jMenuItem1); jMenuItem2.setText("Quitter"); jMenuItem2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem2ActionPerformed(evt); } }); jMenu1.add(jMenuItem2); jMenuBar1.add(jMenu1); jMenuBar1.add(jMenu2); setJMenuBar(jMenuBar1); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addContainerGap().addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed cpt++; if (cpt == 1) { jComboBox2.setVisible(true); jLabel3.setVisible(true); jTextField3.setVisible(true); jTextField11.setVisible(true); } if (cpt == 2) { jComboBox3.setVisible(true); jLabel4.setVisible(true); jTextField4.setVisible(true); jTextField12.setVisible(true); } if (cpt == 3) { jComboBox4.setVisible(true); jLabel5.setVisible(true); jTextField5.setVisible(true); jTextField13.setVisible(true); } if (cpt == 4) { jComboBox5.setVisible(true); jLabel6.setVisible(true); jTextField6.setVisible(true); jTextField14.setVisible(true); } if (cpt == 5) { jComboBox6.setVisible(true); jLabel7.setVisible(true); jTextField7.setVisible(true); jTextField15.setVisible(true); } if (cpt == 6) { jComboBox7.setVisible(true); jLabel8.setVisible(true); jTextField8.setVisible(true); jTextField16.setVisible(true); } if (cpt == 7) { jComboBox8.setVisible(true); jLabel9.setVisible(true); jTextField9.setVisible(true); jTextField17.setVisible(true); } }//GEN-LAST:event_jButton1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed try { ConnectionMongoDB connec = new ConnectionMongoDB(); DB d = connec.getDB(); if (cpt == 1) { DBCollection coll = d.getCollection(a.getText()); BasicDBObject doc = new BasicDBObject(jTextField2.getText(), jTextField10.getText()) .append(jTextField3.getText(), jTextField11.getText()); coll.insert(doc); } if (cpt == 2) { DBCollection coll = d.getCollection(a.getText()); BasicDBObject doc = new BasicDBObject(jTextField2.getText(), jTextField10.getText()) .append(jTextField3.getText(), jTextField11.getText()) .append(jTextField4.getText(), jTextField12.getText()); coll.insert(doc); } if (cpt == 3) { DBCollection coll = d.getCollection(a.getText()); BasicDBObject doc = new BasicDBObject(jTextField2.getText(), jTextField10.getText()) .append(jTextField3.getText(), jTextField11.getText()) .append(jTextField4.getText(), jTextField12.getText()) .append(jTextField5.getText(), jTextField13.getText()); coll.insert(doc); } if (cpt == 4) { DBCollection coll = d.getCollection(a.getText()); BasicDBObject doc = new BasicDBObject(jTextField2.getText(), jTextField10.getText()) .append(jTextField3.getText(), jTextField11.getText()) .append(jTextField4.getText(), jTextField12.getText()) .append(jTextField5.getText(), jTextField13.getText()) .append(jTextField6.getText(), jTextField14.getText()); coll.insert(doc); } if (cpt == 5) { DBCollection coll = d.getCollection(a.getText()); BasicDBObject doc = new BasicDBObject(jTextField2.getText(), jTextField10.getText()) .append(jTextField3.getText(), jTextField11.getText()) .append(jTextField4.getText(), jTextField12.getText()) .append(jTextField5.getText(), jTextField13.getText()) .append(jTextField6.getText(), jTextField14.getText()) .append(jTextField7.getText(), jTextField15.getText()); coll.insert(doc); } if (cpt == 6) { DBCollection coll = d.getCollection(a.getText()); BasicDBObject doc = new BasicDBObject(jTextField2.getText(), jTextField10.getText()) .append(jTextField3.getText(), jTextField11.getText()) .append(jTextField4.getText(), jTextField12.getText()) .append(jTextField5.getText(), jTextField13.getText()) .append(jTextField6.getText(), jTextField14.getText()) .append(jTextField7.getText(), jTextField15.getText()) .append(jTextField8.getText(), jTextField16.getText()); coll.insert(doc); } if (cpt == 7) { DBCollection coll = d.getCollection(a.getText()); BasicDBObject doc = new BasicDBObject(jTextField2.getText(), jTextField10.getText()) .append(jTextField3.getText(), jTextField11.getText()) .append(jTextField4.getText(), jTextField12.getText()) .append(jTextField5.getText(), jTextField13.getText()) .append(jTextField6.getText(), jTextField14.getText()) .append(jTextField7.getText(), jTextField15.getText()) .append(jTextField8.getText(), jTextField16.getText()) .append(jTextField9.getText(), jTextField17.getText()); coll.insert(doc); } javax.swing.JOptionPane.showMessageDialog(null, "La table " + a.getText() + " a bien t cre"); Admin1 admin = new Admin1(); admin.setVisible(true); this.setVisible(false); } catch (UnknownHostException ex) { Logger.getLogger(Admin_NewTable.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jButton2ActionPerformed private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed try { // TODO add your handling code here: Admin_Ajouter ajout = new Admin_Ajouter(); ajout.setVisible(true); this.setVisible(false); } catch (UnknownHostException ex) { Logger.getLogger(Admin_NewTable.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_jMenuItem1ActionPerformed private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed // TODO add your handling code here: int code = 0; System.exit(code); }//GEN-LAST:event_jMenuItem2ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Admin_NewTable.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Admin_NewTable.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Admin_NewTable.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Admin_NewTable.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { try { new Admin_NewTable().setVisible(true); } catch (UnknownHostException ex) { Logger.getLogger(Admin_NewTable.class.getName()).log(Level.SEVERE, null, ex); } } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField a; private javax.swing.JLabel b; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JComboBox jComboBox1; private javax.swing.JComboBox jComboBox2; private javax.swing.JComboBox jComboBox3; private javax.swing.JComboBox jComboBox4; private javax.swing.JComboBox jComboBox5; private javax.swing.JComboBox jComboBox6; private javax.swing.JComboBox jComboBox7; private javax.swing.JComboBox jComboBox8; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JMenu jMenu1; private javax.swing.JMenu jMenu2; private javax.swing.JMenuBar jMenuBar1; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JMenuItem jMenuItem2; private javax.swing.JPanel jPanel1; private javax.swing.JTextField jTextField10; private javax.swing.JTextField jTextField11; private javax.swing.JTextField jTextField12; private javax.swing.JTextField jTextField13; private javax.swing.JTextField jTextField14; private javax.swing.JTextField jTextField15; private javax.swing.JTextField jTextField16; private javax.swing.JTextField jTextField17; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField5; private javax.swing.JTextField jTextField6; private javax.swing.JTextField jTextField7; private javax.swing.JTextField jTextField8; private javax.swing.JTextField jTextField9; // End of variables declaration//GEN-END:variables }