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
|
Object[] ListeSelect = jListLignes.getSelectedValues();
for( int i=0; i<ListeSelect.length; i++ ) {
Object MaSelection = jListLignes.getSelectedValue();
String MonChoix = MaSelection.toString();int valeur = Integer.parseInt(MonChoix);
selection = jListLignes.getSelectedIndex();
valeur=valeur-1;
try {
String ligne=(String) List1.get(valeur);
String deb = ligne.substring(0 ,4);
ListModel.removeElementAt(selection);
if (deb.equals("lig,")) {
String[] c = ligne.split(",");
style = c[0]; couleurTemp = c[1]; Xdebut = c[2]; Ydebut = c[3]; Xfin = c[4]; Yfin = c[5];
List1.remove(valeur);List1.add(valeur, "lig,"+couleur+","+Xdebut+","+Ydebut+","+Xfin+","+Yfin);
}
if (deb.equals("arc,")) {
String[] c = ligne.split(",");
style = c[0]; couleurTemp = c[1]; Xdebut = c[2]; Ydebut = c[3]; Xfin = c[4]; Yfin = c[5];
Xcentre = c[6]; Ycentre = c[7];
List1.remove(valeur);List1.add(valeur, "arc,"+couleur+","+Xdebut+","+Ydebut+","+Xfin+","+Yfin+","+Xcentre+","+Ycentre);
}
}catch (Exception err) {
JOptionPane.showMessageDialog(null,"impossible de changer la ligne.");
System.out.println(err);}
} |
Partager