More on Java form
|
|||
|
Rank: ? (4278)
Member #: 5260 |
I have another problem with the Java form.
The form has textfields, combo-box, radio buttons and checkboxes. There is also a few buttons for submit, clear and exit. Now I have programmed the ActionListener, so that I can submit and record data to file, and I have programmed the exit button to exit out of the program. My problem is the CLEAR button. I can clear text from the textfields and textarea, but I don't know how to clear all selections from the combobox, radio buttons and check boxes. I have been told to use javax.swing packages, so I have looked API of Java Documentation, but I am still at loss on how to proceed further. Can anyone help me with this problem?
Dreams are stories, but my life is just one bad dream. :P
|
||
|
|||
|
|||
|
Rank: ? (4278)
Member #: 5260 |
It is like the RESET button of HTMl/Javascript form, where you press this buttons, and all values are clear from the form components (textfield, pull-down buttons, radiobuttons, checkboxes, etc).
Except here, I want to do exactly the same thing, but using Java programming. I can't seem to find the right method to clear selected values from pull-down menu and radiobuttons. Can someone help?
Dreams are stories, but my life is just one bad dream. :P
|
||
|
|||
|
|||
|
Rank: ? (4821)
Member #: 3416 |
i haven't done much gui programming in java, but in other languages i've been able to clear a dropdown box by setting the selected index to -1. radio buttons are meant to work so that there's always exactly one of them selected, so i would think you could just mark the default one selected in that case.
my mind is like a steel trap! it only hangs on to the big stuff. visit my forums at track7.org
|
||
|
|||
|
|||
|
Rank: ? (4278)
Member #: 5260 |
Your suggestion for -1 on the method for selected index, works fine. Thanks, misterhaan.
As to the radio buttons, I had wished to clear setting so that new record could be inputed. Nevertheless, you have been very helpful in this and in other Java questions. Thanks, again.
Dreams are stories, but my life is just one bad dream. :P
|
||
|
Please login or register to post a reply.