I am currently working on a calculator app that mimics the windows calculator as a side project and I've run into something I can't figure out.
I have a JTextField that has ComponentOrientation set to RIGHT_TO_LEFT, as so:
bottomText.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
and the way I've been adding text is as follows:
bottomText.setText(bottomText.getText() + key.getNumber());
for keys with numbers (0 through 9). The issue is when I try to add a deicmal, like so:
bottomText.setText(bottomText.getText() + ".");
it shows up like ".123" until I press another key, then it switches to "123.4". What is strange is if i do:
bottomText.setText(bottomText.getText() + "f");
replacing the decimal with an "f", it shows how it should normally, i.e. "123f", then "123f4". My decimal representation of the number is just fine (stored in a double variable), but it displays strangely in the JTextField. Does anyone know what is happening here?