This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How do you make a check box work with a JButton?  RSS feed

 
Phillip Larson
Ranch Hand
Posts: 31
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hey Everyone,

I'm working with JCheckBox for the first time and I'm stuck at the moment. I would like to know how do you make a JCheckBox work with a JButton?

Example on how I would like my program to work. When the user choose a check box, I only want it to perform an action when the enter button is press.



Thank for the help everyone.
 
Phillip Larson
Ranch Hand
Posts: 31
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Update: It seem I've got it working

 
Campbell Ritchie
Marshal
Posts: 55677
161
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you been through the Java™ Tutorials? It has a section about check boxes. Here's the link.
 
Phillip Larson
Ranch Hand
Posts: 31
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You
 
Campbell Ritchie
Marshal
Posts: 55677
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Avoid action commands like the plague. You should have one listener object per action required, so don't make a display component implement action listener.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!