1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
| public PanelAjoutVehicule(FenetrePrincipale fenetre, Vehicule vehi)
{
this.fenetre = fenetre;
//this.removeAll();
this.setBorder(BorderFactory.createTitledBorder("Modification d'un véhicule"));
this.setLayout(new BorderLayout());
GestionAction g = new GestionAction();
ModificationVehicule m = new ModificationVehicule();
panneauFormulaire = new JPanel();
panneauFormulaire.setLayout(new GridLayout(10,1));
panneauBoutons = new JPanel();
panneauBoutons.setLayout(new FlowLayout());
try
{
arrayInfos = controle.recupInfos(vehi);
System.out.println(arrayInfos.toString());
}
catch (SQLException ex) {
Logger.getLogger(PanelListing.class.getName()).log(Level.SEVERE, null, ex);
} catch (NamingException ex) {
Logger.getLogger(PanelListing.class.getName()).log(Level.SEVERE, null, ex);
}
labelClient = new JLabel("Client* : ");
labelClient.setHorizontalAlignment(JLabel.RIGHT);
panneauFormulaire.add(labelClient);
comboxClient = new JComboBox();
comboxClient.setSelectedItem(arrayInfos.get(0).toString());
comboxClient.setEditable(false);
panneauFormulaire.add(comboxClient);
labelMarque = new JLabel("Marque* : ");
labelMarque.setHorizontalAlignment(JLabel.RIGHT);
panneauFormulaire.add(labelMarque);
comboxMarque = new JComboBox();
comboxMarque.setSelectedItem(arrayInfos.get(1).toString());
comboxMarque.setEditable(false);
panneauFormulaire.add(comboxMarque);
labelModele = new JLabel("Modele* : ");
labelModele.setHorizontalAlignment(JLabel.RIGHT);
panneauFormulaire.add(labelModele);
comboxModele = new JComboBox();
comboxModele.setSelectedItem(arrayInfos.get(2).toString());
panneauFormulaire.add(comboxModele);
labelChassis = new JLabel("N° Chassis* : ");
labelChassis.setHorizontalAlignment(JLabel.RIGHT);
panneauFormulaire.add(labelChassis);
textChassis = new JTextField(17);
textChassis.setText(vehi.getNChassis());
textChassis.setEditable(true);
panneauFormulaire.add(textChassis);
labelCylindree = new JLabel("Cylindree* : ");
labelCylindree.setHorizontalAlignment(JLabel.RIGHT);
panneauFormulaire.add(labelCylindree);
textCylindree = new JTextField(4);
textCylindree.setText(Integer.toString(vehi.getCylindree()));
textCylindree.setEditable(true);
panneauFormulaire.add(textCylindree);
labelPlaque = new JLabel("Plaque* : ");
labelPlaque.setHorizontalAlignment(JLabel.RIGHT);
panneauFormulaire.add(labelPlaque);
textPlaque = new JTextField(7);
textPlaque.setText(vehi.getPlaque());
textPlaque.setEditable(true);
panneauFormulaire.add(textPlaque);
labelSociete = new JLabel("Societe : ");
labelSociete.setHorizontalAlignment(JLabel.RIGHT);
panneauFormulaire.add(labelSociete);
textSociete = new JTextField(20);
textSociete.setText(vehi.getSociete());
textSociete.setEditable(true);
panneauFormulaire.add(textSociete);
labelLpg = new JLabel("Lpg* : ");
labelLpg.setHorizontalAlignment(JLabel.RIGHT);
checkLpg = new JCheckBox("Oui");
if(vehi.getLpg())
{
checkLpg.setSelected(true);
}
panneauFormulaire.add(labelLpg);
panneauFormulaire.add(checkLpg);
checkLpg.addItemListener(g);
String [] contenu = {"Essence 95","Essence 98","Diesel","Electrique"};
labelCarburant = new JLabel("Carburant* : ");
labelCarburant.setHorizontalAlignment(JLabel.RIGHT);
panneauFormulaire.add(labelCarburant);
comboxCarburant = new JComboBox(contenu);
comboxCarburant.setSelectedItem(vehi.getCarburant());
comboxCarburant.setMaximumRowCount(4);
comboxCarburant.setEditable(false);
panneauFormulaire.add(comboxCarburant);
labelDateRepa = new JLabel("Date debut reparation* : ");
labelDateRepa.setHorizontalAlignment(JLabel.RIGHT);
panneauFormulaire.add(labelDateRepa);
dateDebRepa = new JSpinner();
Calendar cal = Calendar.getInstance();
Date now = cal.getTime();
dateDebRepa.setModel(new SpinnerDateModel(now, now, now, Calendar.MONTH));
dateDebRepa.setEditor(new JSpinner.DateEditor(dateDebRepa, "dd/MM/yyyy"));
panneauFormulaire.add(dateDebRepa);
boutonModifier = new JButton("Modifier");
panneauBoutons.add(boutonModifier, BorderLayout.EAST);
boutonModifier.addActionListener(m);
this.add(panneauFormulaire,BorderLayout.CENTER);
this.add(panneauBoutons,BorderLayout.SOUTH);
//this.repaint();
//this.setVisible(true);
} |
Partager