Title says it all. I get NumberFormatException for obvious reason. I want to input double values to my JTextFields with using comma instead of a dot as the decimal separator since I'm north European.
public void actionPerformed(ActionEvent event2) {
NumberFormat nf = NumberFormat.getInstance(Locale.GERMAN);
double firstW = Double.parseDouble(firstWeight.getText());
double secondW = Double.parseDouble(secondWeight.getText());
double outcome = (firstW - secondW);
nf.setMaximumFractionDigits(2);
JLabel result = new JLabel();
result.setText(nf.format(outcome) +" kg" );
add(result);
setVisible(true);
}