Results 1 to 3 of 3
Thread: jcheckbox item listener
- 02-09-2010, 10:23 AM #1
Member
- Join Date
- Feb 2010
- Posts
- 2
- Rep Power
- 0
jcheckbox item listener (Solved)
i hav tis itemlistener code for jcheckbox. when i click on the jcb, it shows true, which means the checkbox is ticked. when i untick the checkbox, it shows 2 lines, true & false. can any1 advice me which part of my code should i edit to make it print false only? im printing out the false & true to test my actionlistener only.
public void itemStateChanged(ItemEvent e)
{
Object source = e.getItem();
if (source == jcbenable)
{
jtfpriority1.setEditable(true);
jtfpriority2.setEditable(true);
b = true;
System.out.println("true");
}
if (e.getStateChange() == ItemEvent.DESELECTED)
{
jtfpriority1.setEditable(false);
jtfpriority2.setEditable(false);
b = false;
System.out.println("false");
}
}
}Last edited by GUIJAVA; 02-09-2010 at 12:22 PM.
- 02-09-2010, 11:10 AM #2
Have u added the itemlistener to the checkbox ?
Please put complete code to understand fully.Ramya:cool:
- 02-09-2010, 11:15 AM #3
Member
- Join Date
- Feb 2010
- Posts
- 2
- Rep Power
- 0
yes i hav added it to the checkbox. tat was y i gotten the result for the true & false.
the output that was printed was:
true (click once on the checkbox)
true (untick the checkbox & got true & false)
false
i only wish to get a false when i untick the checkbox.
PS. Solved the problem. Thanks for readingLast edited by GUIJAVA; 02-09-2010 at 12:22 PM. Reason: Solved
Similar Threads
-
How can I add JCheckBox to each row?
By batya in forum AWT / SwingReplies: 1Last Post: 11-04-2009, 09:25 PM -
Not able to display icon with JCheckBox
By anindde in forum AWT / SwingReplies: 2Last Post: 11-01-2009, 03:19 AM -
JCheckbox in Jtree
By shajuantony in forum AWT / SwingReplies: 10Last Post: 09-09-2009, 10:42 AM -
Can we add JCheckBox array into JTextArea?
By nancyhung in forum AWT / SwingReplies: 1Last Post: 02-17-2008, 12:07 AM -
jcheckbox issues need help. thanks.
By carlos123 in forum New To JavaReplies: 3Last Post: 11-05-2007, 10:37 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks