Re: JFormattedTextField - NumberFormat interferes with selectAll()




Jeff Higgins wrote:
Hi,
The problem I'm having with the following code is:

When I construct the JFormattedTextFields with a
NumberFormat, the selectAll() method seems to have
no effect.

When I construct the JFormattedTextFields without a
NumberFormat, the selectAll() method seems to work
as I had expected; the JFormattedTextField gaining
focus has it's text selected.

test1Field = new
JFormattedTextField(NumberFormat.getIntegerInstance());
test1Field.setColumns(10);
test1Field.addFocusListener(this);

test2Field = new JFormattedTextField(NumberFormat.getNumberInstance());
test2Field.setColumns(10);
test2Field.addFocusListener(this);


Fixes problem (kinda, I think).
Now on to problems with InputVerifier.

test1Field = new JFormattedTextField(NumberFormat.getIntegerInstance());
test1Field.setFocusLostBehavior(JFormattedTextField.PERSIST);
test1Field.setColumns(10);
test1Field.addFocusListener(this);

test2Field = new JFormattedTextField(NumberFormat.getNumberInstance());
test2Field.setFocusLostBehavior(JFormattedTextField.PERSIST);
test2Field.setColumns(10);
test2Field.addFocusListener(this);


.