Sign in to follow this  

This topic is 3841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi guys, im looking for something rather specific and since Im not too familiar with java GUI I thought Id ask here. Basically i have a vector of strings that I want to edit as easily as possible. My preferred way would be a combo box (drop down is a plus) where the user can select a value and edit it, he should also be able to add and delete values. Is there something that will take care of all that linked to my vector or do I have to program something myself? Thanks. -CProgrammer

Share this post


Link to post
Share on other sites
That doesnt have half the features I am looking for. I suppose youre saying thats all there is and I have to program an exstension. Strange seeing as this is a pretty everyday thing, having a list to edit.

Share this post


Link to post
Share on other sites
There isn't really a "standard" component that directly does what you are wanting. All of the components are more generic than that. JList or JTable would probably provide the best interface, you will need program the add, remove and edit functions yourself. You can directly edit in a JTable. With the JList, you will need to provide a separate text box for the editing.

Share this post


Link to post
Share on other sites
JComboBox lets you select items and edit them. You'll have to create your own button and listeners to support adding and deleting items.
The code should only be about a half page long max. It's not difficult.

Share this post


Link to post
Share on other sites
Quote:
Original post by CProgrammer
That doesnt have half the features I am looking for. I suppose youre saying thats all there is and I have to program an exstension. Strange seeing as this is a pretty everyday thing, having a list to edit.


Look into the API.

JComboBox provides data model, which is a container of arbitrary objects. Make that container contain strings.

The default model implementation already implements the even notifications, so the only operations you need to do to support adding/removing items is to call corresponding methods on the model itself.

In addition, you can make this adding/removing by simply attaching an ActionListener to apropriate control, and then decide whether you need to add/remove/edit what the user has entered.

Share this post


Link to post
Share on other sites
Hmm didn't know about that concept. Thanks.
I admit its not hard to do this yourself using a generic component. However after having program tons of lines of code just for some trivial GUI stuff in my project I got a little tired of it, my bad:)

Thanks for the tips. Will look into all of them.

Share this post


Link to post
Share on other sites

This topic is 3841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this