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
|
private void add_attActionPerformed(java.awt.event.ActionEvent evt) {
att_var.setText(att_var.getText().trim()); // enlever les espaces au debut et à la fin
if (att_var.getText().indexOf(" ") != -1) {
JOptionPane.showMessageDialog(null, "Le nom de l'attribut ne doit pas contenir des espaces");
return;
}
if (!verifierAttribut()) {
return;
}
Attribut attribut = new Attribut();
attribut.nom = att_var.getText();
attribut.accesControl = (String) acces_att.getSelectedItem();
attribut.typeAttribut = (String) type_att.getSelectedItem();
classes.get(indexClasses).attributs.add(attribut);
att_var.setText("");
///// ecrire dans le Test Area à droite
String sorti_att = att_var.getText(); // recuperer nom de la classe
String att_slected ="";
att_slected = att_slected + acces_att.getSelectedItem().toString(); // recuper type d'acces ds variable Strin class_selected
String type_att_selected =""; // att pour recuperer type = class , enum ou interface
type_att_selected = type_att_selected + type_att.getSelectedItem().toString(); // affecter donnée
affich1.append(" Attribut : "+ sorti_att);
affich1.append( "\n Attribut_accès :" + att_slected+"\n Type_attribut : "+type_att_selected);
String message ="cette classe a été bien ajoutée !! ";
affich1.append("\n \n "+ message+ "\n ");
affich1.setEditable(false);
////// fin ecriture
} |
Partager