Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [Help] Changing/limiting values in a combo box based upon text field
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
NVariable




PostPosted: 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, Smile
Sponsor
Sponsor
Sponsor
sponsor
Raknarg




PostPosted: 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.




PostPosted: 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
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: