[Help] Changing/limiting values in a combo box based upon text field
Author |
Message |
NVariable
|
Posted: Sun Mar 23, 2014 7:21 pm Post subject: [Help] Changing/limiting values in a combo box based upon text field |
|
|
Hi, i'm new to Java and I am using eclipse w/ swing to create a number base converter.
I have managed to create the conversion process, from converting from binary, decimal, octal and hexidecimal etc..
I have a text box of what the user wants to convert and two combo boxes one "convert from" and the other "convert to"
what I am having trouble figuring out is how to make it so that the combo box displays only values its able to convert based upon what the user types.
So that combo box contents are changed every time a different value is typed in the text box.
I have been looking around and I have seen something called a Modify Listener.
Thanks, |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Raknarg
|
Posted: Sun Mar 23, 2014 10:48 pm Post subject: RE:[Help] Changing/limiting values in a combo box based upon text field |
|
|
You could probably use a keyListener. Every time the user presses a key, you can update the combo boxes based on the current input. |
|
|
|
|
|
andrew.
|
Posted: Tue Mar 25, 2014 7:36 am Post subject: RE:[Help] Changing/limiting values in a combo box based upon text field |
|
|
I believe that there's a way to add an onChange event listener for the textbox. That way when the user changes the value in the textbox, you can handle it however you'd like.
You probably have to do something similar to this:
http://stackoverflow.com/questions/3953208/value-change-listener-to-jtextfield |
|
|
|
|
|
|
|