Results 1 to 9 of 9
Thread: Java Visibility
- 07-06-2010, 12:41 PM #1
Member
- Join Date
- Jul 2010
- Posts
- 22
- Rep Power
- 0
Java Visibility
I d like to say hi to everybody before all else.
My question is about java's visibility option. I have a text field which is called t4 and two radio buttons which are "yes" and "no". When the program gets started "no" is selected as default and I want text field to be invisible while radio button is "no". If the user clicked "yes", that text field should be visible and if clicked "no" , again invisible. How would I do this ? I mean how can I set invisible as default and then , that invisible option would not affect the program until the program is closed. I am using netbeans 6.7.1
Thanks in advance.. sorry for poor english btw :)
- 07-06-2010, 02:07 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,397
- Blog Entries
- 7
- Rep Power
- 17
Your English is fine, no need to apologize. Put both the 'yes' and 'no' buttons in a ButtonGroup (read the API for that class) and register an ActionListener (read the API documentation again) for both buttons; if the 'yes' button is selected set your component to visible, if the 'no' button is selected (the 'yes' button is not selected in that case bcause of that ButtonGroup object)) set your component to invisible.
kind regards,
Jos
- 07-06-2010, 02:56 PM #3
If i guess right you wish to set the textfield "editable" and not "visible" when user chooses "yes" ..you can do as jTextField.setEditable(false/true);
The Quieter you become the more you are able to hear !
- 07-06-2010, 03:07 PM #4
I thought invisible meant that the component was not present in the container. IE it could not be seen.
That would require removing it and adding it.
- 07-06-2010, 04:59 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,397
- Blog Entries
- 7
- Rep Power
- 17
- 07-06-2010, 06:20 PM #6
Member
- Join Date
- Jul 2010
- Posts
- 22
- Rep Power
- 0
I actually grouped those radio buttons, "Yes" and "No". My problem is when the program gets started, I want t4 (textfield) to be invisible (it should not be shown in the program). when "yes" is selected, t4 becomes visible. When t4 's default visibility is true, program works well but after changing its default values to false , that text field never comes to program again. Thanks for answers ..
- 07-06-2010, 06:23 PM #7
Do you revalidate t4's parent container after changing the visibility?
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 07-06-2010, 06:27 PM #8
Member
- Join Date
- Jul 2010
- Posts
- 22
- Rep Power
- 0
no , I didnt do anything .. how would I do that ?
- 07-07-2010, 03:36 AM #9
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
Similar Threads
-
[SOLVED] JButton actionlistener, if statement, JLabel visibility
By JonoF in forum New To JavaReplies: 2Last Post: 04-19-2009, 05:39 AM -
Newbie help on visibility and static final
By tornado in forum New To JavaReplies: 3Last Post: 11-28-2008, 01:32 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks