Results 1 to 2 of 2
- 04-11-2011, 07:23 AM #1
Member
- Join Date
- Mar 2011
- Posts
- 52
- Rep Power
- 0
How to Enable and Disable JtextField on Selection of Checkbox
Hi All,
I Need to Enable the textbox only when my check box is selected else it will be disable. can i set that text box Editable.
I am trying above code, is there any other thing ?Java Code:boolean chkbox=jCheckBox1.isSelected(); if (chkbox= true) { jTextField1.setEnabled(true); }
Please Help me where i am Wrong....
- 04-11-2011, 12:26 PM #2
Senior Member
- Join Date
- Nov 2010
- Location
- Delhi
- Posts
- 135
- Blog Entries
- 1
- Rep Power
- 0
Use addActionListener api of JCheckBox for this.
You will have to provide an implementation of ActionListener interface.
In the actionPerformed method of ActionListener implementation, you need to write your logic.
Something like which you have written in your post.
Try on your own and if still you are stuck, then come back.
Similar Threads
-
Disable a checkbox in jtable
By pink123 in forum AWT / SwingReplies: 8Last Post: 03-24-2011, 06:29 PM -
Please help : JSP enable/disable button
By kalyana in forum New To JavaReplies: 3Last Post: 03-24-2011, 05:06 PM -
selecting checkbox of parent node not resulting into selction of checkbox of all desc
By aparnakumari in forum AWT / SwingReplies: 3Last Post: 07-27-2010, 09:52 AM -
use javascript to enable/disable hyperlinks
By sauravsinha in forum JavaServer Pages (JSP) and JSTLReplies: 4Last Post: 04-22-2010, 06:04 PM -
How to use "selectOneRadio" to enable/disable a Picklist
By vivekbakshi in forum JavaServer Faces (JSF)Replies: 1Last Post: 04-07-2008, 03:14 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks