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 Frames; import java.awt.Color; import java.awt.Font; import java.awt.GraphicsEnvironment; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.List; import javax.swing.DefaultListModel; import javax.swing.JColorChooser; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.filechooser.FileNameExtensionFilter; import org.jdom2.Attribute; import org.jdom2.DataConversionException; import org.jdom2.Document; import org.jdom2.Element; import org.jdom2.input.SAXBuilder; import org.jdom2.output.Format; import org.jdom2.output.XMLOutputter; /** * * @author Xers */ public class CrExperience2 extends javax.swing.JFrame { /** * Creates new form CrExperience2 */ public Element racine = new Element("experiences"); public String newline = System.getProperty("line.separator"); public org.jdom2.Document document = new Document(racine); DefaultListModel list1 = new DefaultListModel(); DefaultListModel list2 = new DefaultListModel(); String tache = ""; DefaultListModel list; String images = ""; String videos = ""; String sons = ""; JFileChooser chooser; int position; int go = 0; public String choix; Element experience; Attribute ident; EchelleText e; public CrExperience2() { initComponents(); jTextArea1.setEditable(false); jTextArea2.setEditable(false); creerDossier(); try { creerConfig(); } catch (DataConversionException ex) { } jRadioButton1.setSelected(true); list = new DefaultListModel(); int o = javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION; int o2 = javax.swing.ListSelectionModel.SINGLE_SELECTION; jList1.setSelectionMode(o); jList1.setSelectionBackground(Color.cyan); jList2.setSelectionMode(o2); jList2.setSelectionBackground(Color.yellow); jList3.setSelectionMode(o); chooser = new JFileChooser(); initialiser(); remplirJtextArea2(); remplirJlist2(); experience = new Element("experience"); position = 6; racine.addContent(experience); } public void initialiser() { this.setExtendedState(javax.swing.JFrame.MAXIMIZED_BOTH); jPanel19.setVisible(true); jPanel15.setVisible(false); jPanel14.setVisible(false); GraphicsEnvironment e = GraphicsEnvironment.getLocalGraphicsEnvironment(); Font[] fonts = e.getAllFonts(); // Get the fonts for (Font f : fonts) { jComboBox1.addItem(f.getFontName()); jComboBox3.addItem(f.getFontName()); } jComboBox1.setSelectedItem("Arial"); jComboBox3.setSelectedItem("Arial"); jComboBox2.addItem(10); jComboBox2.addItem(11); jComboBox2.addItem(12); jComboBox2.addItem(13); jComboBox2.addItem(14); jComboBox2.addItem(15); jComboBox2.addItem(16); jComboBox2.addItem(17); jComboBox2.addItem(18); jComboBox2.addItem(20); jComboBox2.addItem(21); jComboBox2.addItem(22); jComboBox2.addItem(23); jComboBox2.addItem(24); jComboBox2.addItem(25); jComboBox2.setSelectedIndex(6); jComboBox4.addItem(10); jComboBox4.addItem(11); jComboBox4.addItem(12); jComboBox4.addItem(13); jComboBox4.addItem(14); jComboBox4.addItem(15); jComboBox4.addItem(16); jComboBox4.addItem(17); jComboBox4.addItem(18); jComboBox4.addItem(20); jComboBox4.addItem(21); jComboBox4.addItem(22); jComboBox4.addItem(23); jComboBox4.addItem(24); jComboBox4.addItem(25); jComboBox4.setSelectedIndex(8); buttonGroup1.add(jRadioButton4); buttonGroup1.add(jRadioButton5); buttonGroup1.add(jRadioButton6); buttonGroup1.add(jRadioButton7); buttonGroup1.add(jRadioButton8); buttonGroup1.add(jRadioButton9); buttonGroup1.add(jRadioButton10); buttonGroup1.add(jRadioButton11); jRadioButton9.setSelected(true); buttonGroup2.add(jRadioButton12); buttonGroup2.add(jRadioButton13); buttonGroup3.add(jRadioButton1); buttonGroup3.add(jRadioButton2); buttonGroup3.add(jRadioButton3); jRadioButton1.setSelected(true); buttonGroup4.add(jRadioButton14); buttonGroup4.add(jRadioButton15); buttonGroup4.add(jRadioButton16); //jRadioButton14.setSelected(true); // remplirJtextArea("Exp2/Images/"); } private void creerDossier() { File f = new File("Exp2"); f.mkdir(); f = new File("Exp2/Sons/"); f.mkdir(); f = new File("Exp2/Videos/"); f.mkdir(); f = new File("Exp2/Images/"); f.mkdir(); } private int creerConfig() throws DataConversionException { int x = 0; File f = new File("Exp2/Experiences.xml"); if (f.exists()) { System.out.println("Experiences Existe"); SAXBuilder sxb = new SAXBuilder(); try { document = sxb.build(new File("Exp2/Experiences.xml")); } catch (Exception e) { } racine = document.getRootElement(); if (!racine.getChildren("experience").isEmpty()) { List<Element> childs = racine.getChildren("experience"); x = childs.get(childs.size() - 1).getAttribute("id").getIntValue(); } } else { try { //On utilise ici un affichage classique avec getPrettyFormat() XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat()); //Remarquez qu'il suffit simplement de crer une instance de FileOutputStream //avec en argument le nom du fichier pour effectuer la srialisation. sortie.output(document, new FileOutputStream("Exp2/Experiences.xml")); } catch (IOException ex) { } } return x; } public int verifier(String x) { int test = 0; racine = document.getRootElement(); if (!racine.getChildren("experience").isEmpty()) { List<Element> childs = racine.getChildren("experience"); System.out.println(childs.size()); for (int i = 0; i < childs.size(); i++) { if (childs.get(i).hasAttributes()) if (childs.get(i).getAttribute("id").getValue().equals(x)) { test = 1; } } } return test; } /** * 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() { buttonGroup1 = new javax.swing.ButtonGroup(); buttonGroup2 = new javax.swing.ButtonGroup(); buttonGroup3 = new javax.swing.ButtonGroup(); buttonGroup4 = new javax.swing.ButtonGroup(); jTabbedPane1 = new javax.swing.JTabbedPane(); jPanel1 = new javax.swing.JPanel(); jPanel8 = new javax.swing.JPanel(); jRadioButton1 = new javax.swing.JRadioButton(); jButton3 = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jButton6 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jRadioButton2 = new javax.swing.JRadioButton(); jRadioButton3 = new javax.swing.JRadioButton(); jButton16 = new javax.swing.JButton(); jPanel2 = new javax.swing.JPanel(); jPanel4 = new javax.swing.JPanel(); jRadioButton14 = new javax.swing.JRadioButton(); jScrollPane2 = new javax.swing.JScrollPane(); jTextArea2 = new javax.swing.JTextArea(); jButton7 = new javax.swing.JButton(); jScrollPane3 = new javax.swing.JScrollPane(); jList1 = new javax.swing.JList(); jLabel2 = new javax.swing.JLabel(); jTextField2 = new javax.swing.JTextField(); jLabel23 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jButton11 = new javax.swing.JButton(); jButton24 = new javax.swing.JButton(); jButton25 = new javax.swing.JButton(); jButton17 = new javax.swing.JButton(); jScrollPane7 = new javax.swing.JScrollPane(); jList3 = new javax.swing.JList(); jLabel1 = new javax.swing.JLabel(); jButton4 = new javax.swing.JButton(); jRadioButton15 = new javax.swing.JRadioButton(); jRadioButton16 = new javax.swing.JRadioButton(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jScrollPane5 = new javax.swing.JScrollPane(); jList2 = new javax.swing.JList(); jButton8 = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); jPanel10 = new javax.swing.JPanel(); jPanel11 = new javax.swing.JPanel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jRadioButton4 = new javax.swing.JRadioButton(); jRadioButton5 = new javax.swing.JRadioButton(); jRadioButton6 = new javax.swing.JRadioButton(); jRadioButton7 = new javax.swing.JRadioButton(); jRadioButton8 = new javax.swing.JRadioButton(); jRadioButton9 = new javax.swing.JRadioButton(); jRadioButton10 = new javax.swing.JRadioButton(); jRadioButton11 = new javax.swing.JRadioButton(); jPanel12 = new javax.swing.JPanel(); jLabel14 = new javax.swing.JLabel(); jComboBox3 = new javax.swing.JComboBox(); jButton10 = new javax.swing.JButton(); jLabel15 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); jComboBox4 = new javax.swing.JComboBox(); jPanel13 = new javax.swing.JPanel(); jLabel10 = new javax.swing.JLabel(); jToggleButton1 = new javax.swing.JToggleButton(); jPanel14 = new javax.swing.JPanel(); jLabel11 = new javax.swing.JLabel(); jRadioButton12 = new javax.swing.JRadioButton(); jRadioButton13 = new javax.swing.JRadioButton(); jPanel15 = new javax.swing.JPanel(); textField3 = new java.awt.TextField(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); textField2 = new java.awt.TextField(); jLabel17 = new javax.swing.JLabel(); jButton12 = new javax.swing.JButton(); jPanel19 = new javax.swing.JPanel(); textField1 = new java.awt.TextField(); jLabel18 = new javax.swing.JLabel(); jPanel17 = new javax.swing.JPanel(); jLabel19 = new javax.swing.JLabel(); jScrollPane4 = new javax.swing.JScrollPane(); jTextArea3 = new javax.swing.JTextArea(); jPanel18 = new javax.swing.JPanel(); jLabel20 = new javax.swing.JLabel(); jComboBox1 = new javax.swing.JComboBox(); jButton13 = new javax.swing.JButton(); jLabel21 = new javax.swing.JLabel(); jLabel22 = new javax.swing.JLabel(); jComboBox2 = new javax.swing.JComboBox(); jButton14 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jRadioButton1.setText("Images"); jRadioButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton1ActionPerformed(evt); } }); jButton3.setText("Charger"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jTextArea1.setColumns(20); jTextArea1.setRows(5); jScrollPane1.setViewportView(jTextArea1); jButton6.setText("Vider"); jButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton6ActionPerformed(evt); } }); jButton5.setText("Sauvegarder les Medias"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton5ActionPerformed(evt); } }); jRadioButton2.setText("Videos"); jRadioButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton2ActionPerformed(evt); } }); jRadioButton3.setText("Sons"); jRadioButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton3ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8); jPanel8.setLayout(jPanel8Layout); jPanel8Layout.setHorizontalGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup().addGap(98, 98, 98) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup().addComponent(jRadioButton1) .addGap(18, 18, 18).addComponent(jRadioButton2).addGap(18, 18, 18) .addComponent(jRadioButton3).addGap(33, 33, 33).addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel8Layout.createSequentialGroup() .addGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 441, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup().addComponent(jButton5) .addGap(46, 46, 46))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(62, Short.MAX_VALUE))); jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup() .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel8Layout.createSequentialGroup().addGap(49, 49, 49) .addGroup(jPanel8Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jRadioButton1).addComponent(jRadioButton2) .addComponent(jRadioButton3))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout .createSequentialGroup().addContainerGap().addComponent(jButton3))) .addGap(18, 18, 18) .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 211, Short.MAX_VALUE) .addGroup(jPanel8Layout.createSequentialGroup().addComponent(jButton6).addGap(0, 0, Short.MAX_VALUE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jButton5) .addGap(114, 114, 114))); jButton16.setText("Retour"); jButton16.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton16ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(jPanel1Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel1Layout .createSequentialGroup().addGap(663, 663, 663).addComponent(jButton16, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(764, Short.MAX_VALUE))); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(75, 75, 75).addComponent(jButton16).addGap(0, 232, Short.MAX_VALUE))); jTabbedPane1.addTab("Ajout des Medias", jPanel1); jPanel4.setAutoscrolls(true); jRadioButton14.setText("Images"); jRadioButton14.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton14ActionPerformed(evt); } }); jTextArea2.setColumns(20); jTextArea2.setRows(5); jScrollPane2.setViewportView(jTextArea2); jButton7.setText("Vider"); jButton7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton7ActionPerformed(evt); } }); jList1.setBorder( javax.swing.BorderFactory.createCompoundBorder(null, javax.swing.BorderFactory.createCompoundBorder( null, javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))))); jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); jList1.setToolTipText(""); jList1.setName(""); // NOI18N jScrollPane3.setViewportView(jList1); jLabel2.setText("Question:"); jLabel23.setText("ID:"); jButton11.setText("Valider l'ID"); jButton11.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton11ActionPerformed(evt); } }); jButton24.setText("Enregistrer"); jButton24.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton24ActionPerformed(evt); } }); jButton25.setText("Retour"); jButton25.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton25ActionPerformed(evt); } }); jButton17.setText("Infos"); jButton17.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton17ActionPerformed(evt); } }); jList3.setBorder( javax.swing.BorderFactory.createCompoundBorder(null, javax.swing.BorderFactory.createCompoundBorder( null, javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))))); jList3.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); jList3.setToolTipText(""); jList3.setName(""); // NOI18N jScrollPane7.setViewportView(jList3); jLabel1.setText("Les images rponses"); jButton4.setText("Valider"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jRadioButton15.setText("Videos"); jRadioButton15.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton15ActionPerformed(evt); } }); jRadioButton16.setText("Sons"); jRadioButton16.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton16ActionPerformed(evt); } }); jLabel3.setText("Deuxime image en haut d'cran (Facultatif)"); jLabel4.setText("Premier mdias en haut d'cran (Obligatoire)"); jList2.setBorder( javax.swing.BorderFactory.createCompoundBorder(null, javax.swing.BorderFactory.createCompoundBorder( null, javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))))); jList2.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); jList2.setToolTipText(""); jList2.setName(""); // NOI18N jScrollPane5.setViewportView(jList2); jButton8.setText("dselectioner"); jButton8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton8ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addGap(28, 28, 28) .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 620, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addGap(40, 40, 40) .addComponent(jButton7).addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel4Layout.createSequentialGroup().addGap(317, 317, 317) .addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jButton17, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel4Layout .createParallelGroup( javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton24, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton25, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1).addComponent(jLabel2) .addGroup(jPanel4Layout.createSequentialGroup().addGap(19, 19, 19) .addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jRadioButton16).addComponent(jRadioButton14) .addComponent(jRadioButton15)))) .addGap(28, 28, 28) .addGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 425, Short.MAX_VALUE) .addGroup(jPanel4Layout.createSequentialGroup().addGap(196, 196, 196) .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel4) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 402, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane3)) .addGap(18, 18, 18) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 315, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 425, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 150, Short.MAX_VALUE) .addComponent(jLabel23) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jButton11) .addGap(20, 20, 20)) .addGroup(jPanel4Layout.createSequentialGroup().addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))))); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel4Layout.createSequentialGroup().addComponent(jRadioButton14) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jRadioButton15) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jRadioButton16)) .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel4Layout.createSequentialGroup().addGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel23) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton11)).addGap(29, 29, 29).addComponent(jButton8))) .addGap(18, 18, 18) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2)) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addGap(92, 92, 92) .addComponent(jLabel1)) .addGroup(jPanel4Layout.createSequentialGroup().addGap(26, 26, 26).addComponent( jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(18, 18, 18).addComponent(jButton4) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, Short.MAX_VALUE) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 308, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(98, 98, 98)) .addGroup(jPanel4Layout.createSequentialGroup().addComponent(jButton7) .addGap(38, 38, 38).addComponent(jButton17) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton24) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton25).addContainerGap())))); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(jPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap() .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(172, Short.MAX_VALUE))); jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))); jTabbedPane1.addTab("Cration ", jPanel2); jPanel10.setPreferredSize(new java.awt.Dimension(1000, 847)); jPanel11.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jLabel8.setText("Emplacement :"); jLabel9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/emoticone.png"))); // NOI18N jLabel9.setText("jLabel9"); jRadioButton4.setText("3"); jRadioButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton4ActionPerformed(evt); } }); jRadioButton5.setText("2"); jRadioButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton5ActionPerformed(evt); } }); jRadioButton6.setText("1"); jRadioButton6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton6ActionPerformed(evt); } }); jRadioButton7.setText("5"); jRadioButton7.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton7ActionPerformed(evt); } }); jRadioButton8.setText("4"); jRadioButton8.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton8ActionPerformed(evt); } }); jRadioButton9.setText("6"); jRadioButton9.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton9ActionPerformed(evt); } }); jRadioButton10.setText("7"); jRadioButton10.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton10ActionPerformed(evt); } }); jRadioButton11.setText("8"); jRadioButton11.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton11ActionPerformed(evt); } }); jPanel12.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jLabel14.setText("Font:"); jButton10.setText("Choisir une couleur"); jButton10.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton10ActionPerformed(evt); } }); jLabel15.setText("couleur :"); jLabel16.setText("taille :"); javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12); jPanel12.setLayout(jPanel12Layout); jPanel12Layout.setHorizontalGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup().addContainerGap().addGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup().addComponent(jLabel16).addGap(18, 18, 18) .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel12Layout.createSequentialGroup().addGroup( jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel14).addComponent(jLabel15)) .addGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel12Layout.createSequentialGroup().addGap(5, 5, 5) .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel12Layout .createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton10))))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel12Layout.setVerticalGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel12Layout.createSequentialGroup().addContainerGap().addGroup(jPanel12Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel14) .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton10).addComponent(jLabel15)) .addGap(18, 18, 18) .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel16).addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(26, Short.MAX_VALUE))); javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11); jPanel11.setLayout(jPanel11Layout); jPanel11Layout.setHorizontalGroup(jPanel11Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel11Layout.createSequentialGroup().addContainerGap() .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel11Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(214, 214, 214)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel11Layout.createSequentialGroup() .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel11Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addComponent(jRadioButton5).addGap(80, 80, 80).addComponent(jRadioButton4)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel11Layout .createSequentialGroup().addGap(92, 92, 92) .addGroup(jPanel11Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jRadioButton7).addComponent(jRadioButton6) .addComponent(jRadioButton8)) .addGroup(jPanel11Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel11Layout.createSequentialGroup().addGap(27, 27, 27) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jRadioButton11) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel11Layout.createSequentialGroup().addGap(81, 81, 81) .addComponent(jRadioButton9) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jRadioButton10))))) .addGap(129, 129, 129))); jPanel11Layout.setVerticalGroup(jPanel11Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel11Layout.createSequentialGroup().addGap(12, 12, 12) .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jRadioButton4).addComponent(jRadioButton5) .addComponent(jRadioButton6)) .addGap(15, 15, 15) .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jRadioButton8).addComponent(jRadioButton11)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jRadioButton9).addComponent(jRadioButton10) .addComponent(jRadioButton7)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 29, Short.MAX_VALUE) .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); jPanel13.setBorder(javax.swing.BorderFactory.createCompoundBorder( javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)), null)); jPanel13.setForeground(new java.awt.Color(255, 51, 51)); jPanel13.setPreferredSize(new java.awt.Dimension(400, 297)); jLabel10.setText("Ecran Intermdiaire"); jToggleButton1.setText("ON"); jToggleButton1.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { jToggleButton1StateChanged(evt); } }); jToggleButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jToggleButton1ActionPerformed(evt); } }); jPanel14.setBorder(javax.swing.BorderFactory.createCompoundBorder(null, javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)))); jLabel11.setText("couleur :"); jRadioButton12.setText("fixe"); jRadioButton12.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton12ActionPerformed(evt); } }); jRadioButton13.setText("alatoire"); jRadioButton13.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jRadioButton13ActionPerformed(evt); } }); textField3.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { textField3KeyTyped(evt); } }); jLabel12.setText("ms"); jLabel13.setText(""); textField2.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { textField2KeyTyped(evt); } }); jLabel17.setText("de"); javax.swing.GroupLayout jPanel15Layout = new javax.swing.GroupLayout(jPanel15); jPanel15.setLayout(jPanel15Layout); jPanel15Layout.setHorizontalGroup(jPanel15Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel15Layout.createSequentialGroup().addContainerGap().addComponent(jLabel17) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(textField2, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jLabel13) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(textField3, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE) .addComponent(jLabel12).addContainerGap())); jPanel15Layout .setVerticalGroup(jPanel15Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel15Layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE) .addGroup(jPanel15Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(textField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel13) .addComponent(textField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel12).addComponent(jLabel17)))); jButton12.setText("Choisir une couleur"); jButton12.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton12ActionPerformed(evt); } }); textField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { textField1ActionPerformed(evt); } }); textField1.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { textField1KeyTyped(evt); } }); jLabel18.setText("ms"); javax.swing.GroupLayout jPanel19Layout = new javax.swing.GroupLayout(jPanel19); jPanel19.setLayout(jPanel19Layout); jPanel19Layout .setHorizontalGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel19Layout.createSequentialGroup().addContainerGap() .addComponent(textField1, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel18).addContainerGap(38, Short.MAX_VALUE))); jPanel19Layout.setVerticalGroup(jPanel19Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel19Layout.createSequentialGroup() .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(textField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel18)) .addGap(0, 0, Short.MAX_VALUE))); javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14); jPanel14.setLayout(jPanel14Layout); jPanel14Layout.setHorizontalGroup(jPanel14Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup().addContainerGap().addGroup(jPanel14Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup().addComponent(jRadioButton13) .addGap(18, 18, 18).addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel14Layout.createSequentialGroup().addComponent(jRadioButton12) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel14Layout.createSequentialGroup() .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18).addComponent(jButton12))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel14Layout.setVerticalGroup(jPanel14Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel14Layout.createSequentialGroup().addContainerGap() .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel11).addComponent(jButton12)) .addGap(36, 36, 36) .addGroup( jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jRadioButton12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel19, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jRadioButton13).addComponent(jPanel15, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(107, Short.MAX_VALUE))); javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13); jPanel13.setLayout(jPanel13Layout); jPanel13Layout .setHorizontalGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup().addContainerGap().addComponent(jLabel10) .addGap(18, 18, 18) .addComponent(jToggleButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel13Layout.createSequentialGroup() .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 9, Short.MAX_VALUE))); jPanel13Layout.setVerticalGroup(jPanel13Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel13Layout.createSequentialGroup() .addGroup(jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel10).addComponent(jToggleButton1)) .addGap(27, 27, 27) .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel17.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jLabel19.setText("Consignes:"); jTextArea3.setColumns(20); jTextArea3.setRows(5); jScrollPane4.setViewportView(jTextArea3); jPanel18.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jLabel20.setText("Font:"); jButton13.setText("Choisir une couleur"); jButton13.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton13ActionPerformed(evt); } }); jLabel21.setText("couleur :"); jLabel22.setText("taille :"); jButton14.setText("Valider"); jButton14.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton14ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel18Layout = new javax.swing.GroupLayout(jPanel18); jPanel18.setLayout(jPanel18Layout); jPanel18Layout.setHorizontalGroup(jPanel18Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel18Layout.createSequentialGroup().addContainerGap().addGroup(jPanel18Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel18Layout.createSequentialGroup().addComponent(jLabel22).addGap(18, 18, 18) .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel18Layout.createSequentialGroup().addGroup( jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel20).addComponent(jLabel21)) .addGroup(jPanel18Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel18Layout.createSequentialGroup().addGap(5, 5, 5) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 168, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel18Layout .createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton13))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 76, Short.MAX_VALUE) .addComponent(jButton14).addGap(73, 73, 73))))); jPanel18Layout.setVerticalGroup(jPanel18Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel18Layout.createSequentialGroup().addContainerGap().addGroup(jPanel18Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel20) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton13).addComponent(jLabel21).addComponent(jButton14)) .addGap(18, 18, 18) .addGroup(jPanel18Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel22).addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(26, Short.MAX_VALUE))); jButton2.setText("Retour"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton1.setText("Enregistrer"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel17Layout = new javax.swing.GroupLayout(jPanel17); jPanel17.setLayout(jPanel17Layout); jPanel17Layout.setHorizontalGroup(jPanel17Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel17Layout.createSequentialGroup().addContainerGap().addGroup(jPanel17Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel17Layout.createSequentialGroup() .addGroup(jPanel17Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 447, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel17Layout.createSequentialGroup().addComponent(jLabel19) .addGap(385, 385, 385))) .addGap(106, 106, 106) .addGroup(jPanel17Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1, javax.swing.GroupLayout.DEFAULT_SIZE, 132, Short.MAX_VALUE))) .addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel17Layout.setVerticalGroup(jPanel17Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel17Layout.createSequentialGroup().addContainerGap().addComponent(jLabel19) .addGroup(jPanel17Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel17Layout.createSequentialGroup().addGap(86, 86, 86) .addComponent(jButton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButton2)) .addGroup(jPanel17Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10); jPanel10.setLayout(jPanel10Layout); jPanel10Layout .setHorizontalGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel10Layout.createSequentialGroup().addContainerGap().addGroup(jPanel10Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jPanel17, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel10Layout.createSequentialGroup() .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, 365, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(221, 221, 221).addComponent(jPanel13, javax.swing.GroupLayout.PREFERRED_SIZE, 405, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(455, Short.MAX_VALUE))); jPanel10Layout.setVerticalGroup(jPanel10Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup() .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel10Layout.createSequentialGroup().addContainerGap().addComponent( jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jPanel13, javax.swing.GroupLayout.DEFAULT_SIZE, 381, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel17, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap())); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout .setHorizontalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup().addGap(90, 90, 90) .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, 1456, Short.MAX_VALUE) .addContainerGap())); jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, 772, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(75, 75, 75))); jTabbedPane1.addTab("Configuration", jPanel3); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1561, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 487, Short.MAX_VALUE))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent( jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 802, javax.swing.GroupLayout.PREFERRED_SIZE)); pack(); }// </editor-fold>//GEN-END:initComponents private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: if (!jTextField1.isEnabled() && go == 1) { int option = JOptionPane.showConfirmDialog(rootPane, "Voulez-vous enregistr ?"); if (option == 0) { try { Element configs = new Element("config"); Element emplacement = new Element("emplacement"); configs.addContent(emplacement); Element emplacementQuestion = new Element("EmplacementQuestion"); emplacementQuestion.setText("" + position); emplacement.addContent(emplacementQuestion); Element font = new Element("fons"); font.setText(jComboBox3.getSelectedItem().toString()); emplacement.addContent(font); Element couleur = new Element("couleur"); couleur.setText(jButton10.getForeground().getRed() + "/" + jButton10.getForeground().getGreen() + "/" + jButton10.getForeground().getBlue()); Element taille = new Element("taille"); taille.setText(jComboBox4.getSelectedItem().toString()); emplacement.addContent(couleur); emplacement.addContent(taille); if (jToggleButton1.isSelected()) { Element ecran = new Element("ecran"); Element couleur2 = new Element("couleur"); couleur2.setText(jButton12.getForeground().getRed() + "/" + jButton12.getForeground().getGreen() + "/" + jButton12.getForeground().getBlue()); ecran.addContent(couleur2); if (jRadioButton12.isSelected()) { Attribute type = new Attribute("type", "fixe"); ecran.setAttribute(type); Element fixe = new Element("fixe"); fixe.setText(textField1.getText()); ecran.addContent(fixe); } else if (jRadioButton13.isSelected()) { Attribute type = new Attribute("type", "aleatoire"); ecran.setAttribute(type); Element aleatoire = new Element("aleatoire"); Element de = new Element("de"); de.setText(textField2.getText()); Element a = new Element("a"); a.setText(textField3.getText()); aleatoire.addContent(de); aleatoire.addContent(a); ecran.addContent(aleatoire); } configs.addContent(ecran); } Element consigne = new Element("consigne"); Element text = new Element("text"); text.setText(jTextArea3.getText()); consigne.addContent(text); Element font2 = new Element("fons"); font2.setText(jComboBox1.getSelectedItem().toString()); consigne.addContent(font2); Element couleur3 = new Element("couleur"); couleur3.setText(jButton13.getForeground().getRed() + "/" + jButton13.getForeground().getGreen() + "/" + jButton13.getForeground().getBlue()); consigne.addContent(couleur3); Element taille1 = new Element("taille"); taille1.setText(jComboBox2.getSelectedItem().toString()); consigne.addContent(taille1); configs.addContent(consigne); experience.addContent(configs); //On utilise ici un affichage classique avec getPrettyFormat() XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat()); //Remarquez qu'il suffit simplement de crer une instance de FileOutputStream //avec en argument le nom du fichier pour effectuer la srialisation. sortie.output(document, new FileOutputStream("Exp2/Experiences.xml")); jTextArea2.setText(""); this.setVisible(false); CrExperience1 cr = new CrExperience1(); cr.setVisible(true); cr.setLocationRelativeTo(null); } catch (java.io.IOException e) { } } else { } } else { JOptionPane.showMessageDialog(rootPane, "Entrez un ID et veuillez le vrfifier SVP! ou Remplissez bien le formulaire !"); } }//GEN-LAST:event_jButton1ActionPerformed private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed // TODO add your handling code here: CreationExperience a = new CreationExperience(); a.setVisible(true); this.setVisible(false); }//GEN-LAST:event_jButton2ActionPerformed private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed Font font1 = new Font(jComboBox1.getSelectedItem().toString(), Font.PLAIN, Integer.parseInt(jComboBox2.getSelectedItem().toString())); jTextArea3.setFont(font1); jTextArea3.setForeground(jButton13.getForeground()); }//GEN-LAST:event_jButton14ActionPerformed private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed // TODO add your handling code here: JColorChooser jc = new JColorChooser(); Color newColor = jc.showDialog(this, "Choose Background Color", Color.BLACK); jButton13.setForeground(newColor); }//GEN-LAST:event_jButton13ActionPerformed private void textField1KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textField1KeyTyped // TODO add your handling code here: }//GEN-LAST:event_textField1KeyTyped private void textField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_textField1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_textField1ActionPerformed private void jButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton12ActionPerformed JColorChooser jc = new JColorChooser(); Color newColor = jc.showDialog(this, "Choose Background Color", Color.BLACK); jButton12.setForeground(newColor); }//GEN-LAST:event_jButton12ActionPerformed private void textField2KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textField2KeyTyped // TODO add your handling code here: }//GEN-LAST:event_textField2KeyTyped private void textField3KeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_textField3KeyTyped // TODO add your handling code here: }//GEN-LAST:event_textField3KeyTyped private void jRadioButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton13ActionPerformed // TODO add your handling code here: jPanel19.setVisible(false); jPanel15.setVisible(true); }//GEN-LAST:event_jRadioButton13ActionPerformed private void jRadioButton12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton12ActionPerformed // TODO add your handling code here: jPanel19.setVisible(true); jPanel15.setVisible(false); }//GEN-LAST:event_jRadioButton12ActionPerformed private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jToggleButton1ActionPerformed private void jToggleButton1StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jToggleButton1StateChanged // TODO add your handling code here: if (jToggleButton1.isSelected()) { jPanel14.setVisible(true); jRadioButton12.setSelected(true); } else jPanel14.setVisible(false); }//GEN-LAST:event_jToggleButton1StateChanged private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed // TODO add your handling code here: JColorChooser jc = new JColorChooser(); Color newColor = jc.showDialog(this, "Choose Background Color", Color.BLACK); jButton10.setForeground(newColor); }//GEN-LAST:event_jButton10ActionPerformed private void jRadioButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton11ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jRadioButton11ActionPerformed private void jRadioButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton10ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jRadioButton10ActionPerformed private void jRadioButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton9ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jRadioButton9ActionPerformed private void jRadioButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton8ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jRadioButton8ActionPerformed private void jRadioButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton7ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jRadioButton7ActionPerformed private void jRadioButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton6ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jRadioButton6ActionPerformed private void jRadioButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton5ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jRadioButton5ActionPerformed private void jRadioButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton4ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jRadioButton4ActionPerformed private void jRadioButton16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton16ActionPerformed // TODO add your handling code here: choix = "son"; list.removeAllElements(); remplirJtextArea("Exp2/Sons/"); }//GEN-LAST:event_jRadioButton16ActionPerformed private void jRadioButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton15ActionPerformed // TODO add your handling code here: choix = "video"; list.removeAllElements(); remplirJtextArea("Exp2/Videos/"); }//GEN-LAST:event_jRadioButton15ActionPerformed private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed // TODO add your handling code here: if (!jList1.getSelectedValuesList().isEmpty() && !jList3.getSelectedValuesList().isEmpty() && !"".equals(jTextField2.getText()) && !jTextField1.isEnabled()) { for (int i = 0; i < jList1.getSelectedValuesList().size(); i++) { String te = ""; Element stimule = new Element("stimul"); Attribute media = new Attribute("media", choix); stimule.setAttribute(media); experience.addContent(stimule); Element url = new Element("url"); url.setText(jList1.getSelectedValuesList().get(i).toString()); stimule.addContent(url); Element question = new Element("quesiton"); question.setText(jTextField2.getText()); stimule.addContent(question); if (!jList2.getSelectedValuesList().isEmpty()) { Element url2 = new Element("url2"); url2.setText(jList2.getSelectedValue().toString()); stimule.addContent(url2); } for (int j = 0; j < jList3.getSelectedValuesList().size(); j++) { te = te + "/" + jList3.getSelectedValuesList().get(j).toString(); Element img = new Element("img"); img.setText(jList3.getSelectedValuesList().get(j).toString()); stimule.addContent(img); } tache = tache + jList1.getSelectedValuesList().get(i).toString() + "/" + jTextField2.getText() + te + "/" + newline + "\n"; } jTextArea2.setText(tache); go = 1; } else { JOptionPane.showMessageDialog(rootPane, "Remplissez bien le formulaire"); } }//GEN-LAST:event_jButton4ActionPerformed private void jButton17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton17ActionPerformed JOptionPane.showMessageDialog(rootPane, "1: Validez l'ID\n2: Choisir un ou plusieurs medias [si vide, Ajoutez les mdias] \n Dans le haut de l'ecran a peut tre afficher 2 mdias:\n Image+Image ou Video+image ou Son+Image \n3:Tapez votre question\n4: Choisissez le type de rponse\n5: Entrez vos rponses\n6: Validez et Enregistrer"); }//GEN-LAST:event_jButton17ActionPerformed private void jButton25ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton25ActionPerformed // TODO add your handling code here: CreationExperience a = new CreationExperience(); a.setVisible(true); a.setLocationRelativeTo(null); this.setVisible(false); }//GEN-LAST:event_jButton25ActionPerformed private void jButton24ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton24ActionPerformed // TODO add your handling code here: if (!jTextField1.isEnabled() && go == 1) { int option = JOptionPane.showConfirmDialog(rootPane, "Voulez-vous enregistr ?"); if (option == 0) { try { Element configs = new Element("config"); Element emplacement = new Element("emplacement"); configs.addContent(emplacement); Element emplacementQuestion = new Element("EmplacementQuestion"); emplacementQuestion.setText("" + position); emplacement.addContent(emplacementQuestion); Element font = new Element("fons"); font.setText(jComboBox3.getSelectedItem().toString()); emplacement.addContent(font); Element couleur = new Element("couleur"); couleur.setText(jButton10.getForeground().getRed() + "/" + jButton10.getForeground().getGreen() + "/" + jButton10.getForeground().getBlue()); Element taille = new Element("taille"); taille.setText(jComboBox4.getSelectedItem().toString()); emplacement.addContent(couleur); emplacement.addContent(taille); if (jToggleButton1.isSelected()) { Element ecran = new Element("ecran"); Element couleur2 = new Element("couleur"); couleur2.setText(jButton12.getForeground().getRed() + "/" + jButton12.getForeground().getGreen() + "/" + jButton12.getForeground().getBlue()); ecran.addContent(couleur2); if (jRadioButton12.isSelected()) { Attribute type = new Attribute("type", "fixe"); ecran.setAttribute(type); Element fixe = new Element("fixe"); System.out.println("BOn"); fixe.setText(textField1.getText()); ecran.addContent(fixe); } else if (jRadioButton13.isSelected()) { Attribute type = new Attribute("type", "aleatoire"); ecran.setAttribute(type); Element aleatoire = new Element("aleatoire"); Element de = new Element("de"); de.setText(textField2.getText()); Element a = new Element("a"); a.setText(textField3.getText()); aleatoire.addContent(de); aleatoire.addContent(a); ecran.addContent(aleatoire); } configs.addContent(ecran); } Element consigne = new Element("consigne"); Element text = new Element("text"); text.setText(jTextArea3.getText()); consigne.addContent(text); Element font2 = new Element("fons"); font2.setText(jComboBox1.getSelectedItem().toString()); consigne.addContent(font2); Element couleur3 = new Element("couleur"); couleur3.setText(jButton13.getForeground().getRed() + "/" + jButton13.getForeground().getGreen() + "/" + jButton13.getForeground().getBlue()); consigne.addContent(couleur3); Element taille1 = new Element("taille"); taille1.setText(jComboBox2.getSelectedItem().toString()); consigne.addContent(taille1); configs.addContent(consigne); experience.addContent(configs); //On utilise ici un affichage classique avec getPrettyFormat() XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat()); //Remarquez qu'il suffit simplement de crer une instance de FileOutputStream //avec en argument le nom du fichier pour effectuer la srialisation. sortie.output(document, new FileOutputStream("Exp2/Experiences.xml")); jTextArea2.setText(""); this.setVisible(false); CrExperience1 cr = new CrExperience1(); cr.setVisible(true); cr.setLocationRelativeTo(null); } catch (java.io.IOException e) { } } else { } } else { JOptionPane.showMessageDialog(rootPane, "Entrez un ID et veuillez le vrfifier SVP! ou Remplissez bien le formulaire !"); } }//GEN-LAST:event_jButton24ActionPerformed private void jButton11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton11ActionPerformed // TODO add your handling code here: if (!jTextField1.getText().isEmpty()) { if (verifier(jTextField1.getText()) == 0) { jTextField1.setEnabled(false); ident = new Attribute("id", jTextField1.getText()); experience.setAttribute(ident); } else { JOptionPane.showMessageDialog(rootPane, jTextField1.getText() + " existe, veulliez le changer SVP!"); jTextField1.setText(""); } } else { JOptionPane.showMessageDialog(rootPane, "Entre l'ID et verifiez SVP!"); } }//GEN-LAST:event_jButton11ActionPerformed private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jButton7ActionPerformed private void jRadioButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton14ActionPerformed // TODO add your handling code here: choix = "image"; list.removeAllElements(); remplirJtextArea("Exp2/Images/"); }//GEN-LAST:event_jRadioButton14ActionPerformed private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton16ActionPerformed // TODO add your handling code here: CreationExperience a = new CreationExperience(); a.setVisible(true); a.setLocationRelativeTo(null); this.setVisible(false); }//GEN-LAST:event_jButton16ActionPerformed private void jRadioButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton3ActionPerformed // TODO add your handling code here: jTextArea1.setText(sons); }//GEN-LAST:event_jRadioButton3ActionPerformed private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed // TODO add your handling code here: jTextArea1.setText(videos); }//GEN-LAST:event_jRadioButton2ActionPerformed private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed // TODO add your handling code here: if (!jTextArea1.getText().isEmpty()) { String[] f = jTextArea1.getText().split("\n"); String sortie = ""; if (jRadioButton1.isSelected()) { sortie = "Exp2/Images/"; } else if (jRadioButton2.isSelected()) { sortie = "Exp2/Videos/"; } else { sortie = "Exp2/Sons/"; } for (int i = 0; i < f.length; i++) { File fichier = new File(f[i]); File sortieFile = new File(sortie + fichier.getName()); CopierFichier(fichier, sortieFile); remplirJlist2(); remplirJtextArea2(); } JOptionPane.showMessageDialog(rootPane, "Copie Trmine !!"); } { } }//GEN-LAST:event_jButton5ActionPerformed private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed // TODO add your handling code here: jTextArea1.setText(""); }//GEN-LAST:event_jButton6ActionPerformed private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed // TODO add your handling code here: chooser.setApproveButtonText("Slectionner"); chooser.setMultiSelectionEnabled(true); if (jRadioButton1.isSelected()) { chooser.setFileFilter(new FileNameExtensionFilter("Fichiers Images", "jpg", "png", "tif")); images = remplir(); } else if (jRadioButton2.isSelected()) { chooser.setFileFilter(new FileNameExtensionFilter("Fichiers Video", "mp4", "avi")); videos = remplir(); } else { chooser.setFileFilter(new FileNameExtensionFilter("Fichiers Audio", "mp3")); sons = remplir(); } }//GEN-LAST:event_jButton3ActionPerformed private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed // TODO add your handling code here: jTextArea1.setText(images); }//GEN-LAST:event_jRadioButton1ActionPerformed private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed // TODO add your handling code here: remplirJlist2(); }//GEN-LAST:event_jButton8ActionPerformed private String remplir() { String x = ""; chooser.showOpenDialog(null); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); System.out.println(chooser.getSelectedFiles().length); for (int i = 0; i < chooser.getSelectedFiles().length; i++) { File f = chooser.getSelectedFiles()[i]; if (f != null) { x = x + f.getPath() + "\n"; jTextArea1.setText(jTextArea1.getText() + f.getPath() + "\n"); } } return x; } private boolean CopierFichier(File Source, File Destination) { boolean resultat = false; FileInputStream filesource = null; FileOutputStream fileDestination = null; try { filesource = new FileInputStream(Source); fileDestination = new FileOutputStream(Destination); byte buffer[] = new byte[512 * 1024]; int nblecture; while ((nblecture = filesource.read(buffer)) != -1) { fileDestination.write(buffer, 0, nblecture); } resultat = true; } catch (FileNotFoundException nf) { nf.printStackTrace(); } catch (IOException io) { io.printStackTrace(); } finally { try { filesource.close(); } catch (Exception e) { e.printStackTrace(); } try { fileDestination.close(); } catch (Exception e) { e.printStackTrace(); } } return resultat; } public void remplirJtextArea(String ch) { File r = new File(ch); list.removeAllElements(); for (int i = 0; i < r.listFiles().length; i++) { File p = r.listFiles()[i]; list.addElement(ch + p.getName()); } jList1.setModel(list); } public void remplirJtextArea2() { File r = new File("Exp2/Images/"); list1.removeAllElements(); for (int i = 0; i < r.listFiles().length; i++) { File p = r.listFiles()[i]; list1.addElement("Exp2/Images/" + p.getName()); } jList3.setModel(list1); } /** * @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(CrExperience2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(CrExperience2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(CrExperience2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(CrExperience2.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() { new CrExperience2().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup buttonGroup1; private javax.swing.ButtonGroup buttonGroup2; private javax.swing.ButtonGroup buttonGroup3; private javax.swing.ButtonGroup buttonGroup4; private javax.swing.JButton jButton1; private javax.swing.JButton jButton10; private javax.swing.JButton jButton11; private javax.swing.JButton jButton12; private javax.swing.JButton jButton13; private javax.swing.JButton jButton14; private javax.swing.JButton jButton16; private javax.swing.JButton jButton17; private javax.swing.JButton jButton2; private javax.swing.JButton jButton24; private javax.swing.JButton jButton25; private javax.swing.JButton jButton3; private javax.swing.JButton jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton6; private javax.swing.JButton jButton7; private javax.swing.JButton jButton8; private javax.swing.JComboBox jComboBox1; private javax.swing.JComboBox jComboBox2; private javax.swing.JComboBox jComboBox3; private javax.swing.JComboBox jComboBox4; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel19; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel20; private javax.swing.JLabel jLabel21; private javax.swing.JLabel jLabel22; private javax.swing.JLabel jLabel23; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JList jList1; private javax.swing.JList jList2; private javax.swing.JList jList3; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel10; private javax.swing.JPanel jPanel11; private javax.swing.JPanel jPanel12; private javax.swing.JPanel jPanel13; private javax.swing.JPanel jPanel14; private javax.swing.JPanel jPanel15; private javax.swing.JPanel jPanel17; private javax.swing.JPanel jPanel18; private javax.swing.JPanel jPanel19; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel8; private javax.swing.JRadioButton jRadioButton1; private javax.swing.JRadioButton jRadioButton10; private javax.swing.JRadioButton jRadioButton11; private javax.swing.JRadioButton jRadioButton12; private javax.swing.JRadioButton jRadioButton13; private javax.swing.JRadioButton jRadioButton14; private javax.swing.JRadioButton jRadioButton15; private javax.swing.JRadioButton jRadioButton16; private javax.swing.JRadioButton jRadioButton2; private javax.swing.JRadioButton jRadioButton3; private javax.swing.JRadioButton jRadioButton4; private javax.swing.JRadioButton jRadioButton5; private javax.swing.JRadioButton jRadioButton6; private javax.swing.JRadioButton jRadioButton7; private javax.swing.JRadioButton jRadioButton8; private javax.swing.JRadioButton jRadioButton9; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JScrollPane jScrollPane3; private javax.swing.JScrollPane jScrollPane4; private javax.swing.JScrollPane jScrollPane5; private javax.swing.JScrollPane jScrollPane7; private javax.swing.JTabbedPane jTabbedPane1; private javax.swing.JTextArea jTextArea1; private javax.swing.JTextArea jTextArea2; private javax.swing.JTextArea jTextArea3; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JToggleButton jToggleButton1; private java.awt.TextField textField1; private java.awt.TextField textField2; private java.awt.TextField textField3; // End of variables declaration//GEN-END:variables private void remplirJlist2() { File r = new File("Exp2/Images/"); list2.removeAllElements(); for (int i = 0; i < r.listFiles().length; i++) { File p = r.listFiles()[i]; list2.addElement("Exp2/Images/" + p.getName()); } jList2.setModel(list2); } }