cmp2
asked on
Adding a "formatter" to an editable JComboBox
Hi,
How do I make an editable JCombobox behave like a JFormattedTextFiled with a Formatter (i.e. not allow certain characters such a commas and periods)?
Thanks,
Cmp2
How do I make an editable JCombobox behave like a JFormattedTextFiled with a Formatter (i.e. not allow certain characters such a commas and periods)?
Thanks,
Cmp2
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Nevermind, I figured it out.
JComboBox a = new JComboBox();
JTextField c = (JTextField)a.getEditor(). getEditorC omponent() ;
c.setDocument(...);
Thanks for the suggestion.
JComboBox a = new JComboBox();
JTextField c = (JTextField)a.getEditor().
c.setDocument(...);
Thanks for the suggestion.
ASKER
I know how to add a DocumentFilter on a text field, but how do you add a FilterDocument to a JComboBox?
Cmp2