I'm not sure if this is the right place to post this, but here i go: i'm building an app that basically allows users to fullfill some forms, which then are persisted to a database. At a certain point i've a multiple choice question: Which strategies did you use in order to achieve your goals? And then i show check boxes with respective labels (text): - strategie A - strategie B - etc - others strategies. Now, if user choses this last one, i wanted her to be able to insert each new strategie in a way that every new strategie from user would be inserted into a new line in a related table in database. How can i achieve it? Which swing component could performe it? Or there is an alternative way of doing this? Thanks in advance
I'm not sure whether I understood, so I make a new example to show what I understood:
Now the first user inserts 'a4: ruby' The second 'a4: prolog' The third 'a4: ruby'. Your database may look like this:
You might use a single JTextField which disabled by default, or setEditable (false) - see the docs for that - and enabled when marking q4. Or a JComboBox, which is populated by the new values, but contains an empty line, to insert a new value. This might prevent users from entering 'delphi Delphi DELPHI, "MS Delphi", "Delphi 7.0" and perhaps Delfi' if the 'Delphi'-man comes first
In first place thanks for your reply! I guess i mean another thing: user chooses whatever,as you said, and then chooses 'other' Then, she should be able to input: java c c++ etc; another user who also chooses 'other' might want to input: java pascal another might just want: delphi etc etc What i want now is that the related table looks like this:
Hope i made myself clearer this time [ May 12, 2004: Message edited by: miguel lisboa ]
You could create a combobox. When the user selects a nonempty entry, you create a second combobox, where the second item might be choosen.
Or a combobox with multi-selection (by hitting control).
Or you create two lists:
with add- and remove-button, and a field for new entrys.
Joined: Feb 08, 2004
Better late then never Yes! that's the right idea and i got it working! and there's a similar solution in a listdemo example from sun tutorials (hire and fire buttons that add/remove to a jlist) Thanks a lot!