(The title is misleading, this post has nothing to do with the Scanner class. Before I edited my post it had to do with the Scanner class, but not anymore).
Hey, I've made a simple GUI which contains some JTextFields (Swing) where the user gets to input a double (but since it's JTextFields the input gets stored in a String). In order to process inputed string and to extract the double I use Double.parseDouble(inputedString).
But it says it's an invalid input if I enter for example "3,14". Observe, ',' decimal point instead of a '.' (because it's swedish standards). So in order to get around this I tried adding this in the beginning of my code:
This kind of works since my program now outputs doubles with a ',' as decimal point. But I still can't input using a ','. Help? Let me know if you need the rest of my code.
Locale.setDefault(new Locale("sv","SE")); //according to this book I got, this should set it to swedish standards
See the API docs for DecimalFormat and it's parse method. And make sure to read the entire method description carefully.