je suis encore une autre fois tombé dans cette erreur
mais c'est forcement il vient de la :
public String toS(double d ){
try{
DecimalFormat df = new DecimalFormat("#,##0.00");
return df.format(d);
}catch(Exception e){
e.printStackTrace();
JOptionPane.showMessageDialog(null, " erreur conversion au String !"+e,"ERROR", JOptionPane.ERROR_MESSAGE);
return null;
}
}
et quand j'utilise ma table :
alors lors de la conversion en double op c'est le probleme
Object[] a = {dtm.getValueAt(index, 0), dtm.getValueAt(index, 1),
new Double(""+dtm.getValueAt(index, 5).toString()),
new Integer(1),
dtm.getValueAt(index, 3),
new Double(""+dtm.getValueAt(index, 5).toString()),
new Double(""+dtm.getValueAt(index, 4).toString()),
new Boolean (false)};
aaa.getMtm().addRow(a);
et l'erreur :
java.lang.NumberFormatException: For input string: "300 000,00"
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at java.lang.Double.valueOf(Unknown Source)
at java.lang.Double.(Unknown Source)
at com.kha.commande_f.dialog_list_article$1.actionPerformed(dialog_list_article.java:110)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
et parfois quand je modifie comme ca ou comme si
j'aurai :
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Cannot format given Object as a Number
at java.text.DecimalFormat.format(Unknown Source)
at java.text.Format.format(Unknown Source)
s'ilvous plait si vous pouvez m'indiquer comment utiliser ce number format avec le double et remedier a tous ces problemes selon vos experiences
merci