Issue Details (XML | Word | Printable)

Key: SWINGX-1544
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Karl Schaefer
Reporter: bskaarup
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
swingx

JFormattedTextField.setFormatterFactory makes autocomplete work different

Created: 13/Feb/13 11:36 AM   Updated: 13/Feb/13 11:36 AM
Component/s: Autocomplete
Affects Version/s: 1.6.5
Fix Version/s: None

Time Tracking:
Not Specified

Environment:

Java 7U13, Windows 8 Enterprise


Tags:
Participants: bskaarup and Karl Schaefer


 Description  « Hide

I am having a problem getting autocompletion to work correctly in JFormattetTextField.
When I set the formatter factory the autocomplete seems to work as if it was strict
Run the code and write F and press Delete and tabulate out of the field.
I expected there to be a "F" in the field, but it contains "Foo"
If i avoid setting the formatter factory, it works as I expected.
Is this the intended behaviour?
Is there some other way I should enable the autocomplete feature?

AutoCompletionTest.java
public class AutoCompletionTest {
	public static void main(String[] args) {
		JFrame f = new JFrame();
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		DefaultFormatterFactory dff = new DefaultFormatterFactory(new DefaultFormatter());
		JFormattedTextField tf = new JFormattedTextField();		
		tf.setFormatterFactory(dff); // Disable this line and AutoCompleteDecorator works as I expect
		AutoCompleteDecorator.decorate(tf, java.util.Arrays.asList("Foo", "Bar"), false);
		JPanel p = new JPanel(new BorderLayout());
		p.add(tf);
		p.add(new JButton("Button"), BorderLayout.SOUTH);
		f.add(p);
		f.setSize(300, 100);
		f.setLocationRelativeTo(null);
		f.setVisible(true);
	}
}


There are no comments yet on this issue.