public JPanel creerHaut() { JPanel panneauHaut = new JPanel(); panneauHaut.setLayout(new BoxLayout(panneauHaut, BoxLayout.Y_AXIS)); JLabel fonction = new JLabel("STOCK"); fonction.setFont(new Font("Helvetica", Font.ITALIC, 48)); fonction.setAlignmentX(CENTER_ALIGNMENT); panneauHaut.add(Box.createRigidArea(new Dimension(0, 20))); panneauHaut.add(fonction); panneauHaut.add(Box.createRigidArea(new Dimension(0, 20))); JPanel cl = new JPanel(); JLabel client = new JLabel("Client: "); Vector<String> clients = cets.findAllClients(); comboClients = new JComboBox<String>(clients); comboClients.setPreferredSize(new Dimension(150, 20)); comboClients.setEditable(false); cl.add(client); cl.add(comboClients); ControlJComboBoxClientVanessaStock controlComboClients = new ControlJComboBoxClientVanessaStock(cets, this, modele); comboClients.addActionListener(controlComboClients); panneauHaut.add(cl); return panneauHaut; }
public void actionPerformed(ActionEvent e) { Piece p = cets.findPiece( mere.getComboBoxes().getComboClients().getSelectedItem().toString(), mere.getComboBoxes().getComboModeles().getSelectedItem().toString(), mere.getComboBoxes().getComboTissus().getSelectedItem().toString(), mere.getComboBoxes().getComboCouleurs().getSelectedItem().toString()); for (int i = 0; i < 10; i++) { String longueur = mere.getTableau().getValueAt(i, 1).toString(); if (longueur.equals("") == false) { Patron patron = new Patron( p.getId_piece(), mere.getComboRef().getSelectedItem().toString(), 30 + 2 * i, Double.parseDouble(mere.getLaizeField().getText()), Double.parseDouble(longueur)); try { cets.savePatron(patron, true); } catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog( mere, "On ne peut pas!", "Erreur!", JOptionPane.ERROR_MESSAGE); } } } try { JOptionPane.showMessageDialog( mere, "Patronnages enregistrés", "Validation de votre saisie", JOptionPane.PLAIN_MESSAGE); new MarleneAccueil(mere.getMere(), cets, true).setVisible(true); mere.dispose(); } catch (Exception ex) { ex.printStackTrace(); JOptionPane.showMessageDialog(mere, "On ne peut pas!", "Erreur!", JOptionPane.ERROR_MESSAGE); } }