• Post Reply Bookmark Topic Watch Topic
  • New Topic

GridBagLayout & Refreshing Checkboxes  RSS feed

 
window listener
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was hoping someone might be able to help me with this little problem I'm having. I have created a sharp looking GUI on a GridBagLayout but I'm having some trouble with clearing all the feilds. I have a clear button that when pushed should clear all textfields and check boxes. So far I am having no luck w/the checkboxes. Any Ideas would be greatly appreciated
Thanks
Steve Kiernan
 
kshitij raval
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using AWT components:
setState(boolean state) java.awt.Checkbox
If you are using JFC components:
setSelected(boolean b) of javax.swing.AbstractButton class
Note that setSelected() method does not trigger an actionEvent.
Call doClick to perform a programatic action change.
Hope this will help.
 
window listener
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kshitij raval:
If you are using AWT components:
setState(boolean state) java.awt.Checkbox
If you are using JFC components:
setSelected(boolean b) of javax.swing.AbstractButton class
Note that setSelected() method does not trigger an actionEvent.
Call doClick to perform a programatic action change.
Hope this will help.

I am using awt components and I have used this code
if(src == buttonClear)
{
checkbox.setState(false);
}
this only works if the button has not changed its initial state
what do I need to do differently to change it back to the false state once it has already been set to true.
Thanks for your help
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your name does not follow the offical naming policy. Please regisiter.
Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!