• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ItemListener: checkbox component

 
Natalie Green
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,

Could anybody, please, help with ItemListener: checkbox component

I want to display a picture by clicking on the checkbox.

Here is my code:



Applet

 
Stephan van Hulst
Bartender
Pie
Posts: 6503
83
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Natalie!

When you post a new topic, be sure to include an actual question. Few people will read through the code just to figure out what problem you're having.
 
Maneesh Godbole
Saloon Keeper
Posts: 11312
16
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I notice you are using awt which has been outdated since long. The recommended substitute is swing.
Swing offers 1 to 1 substitute for almost all components. (swing substitutes are typically preceded with a 'J')
e.g.
Button (AWT) -> JButton (Swing)
Checkbox -> JCheckBox
Panel -> JPanel

In swing, you figure out the user selection via Listeners
In pseudo code
Create a JCheckBox
Add an ActionListener
When notified process the choice.

More information on this subject can be found at http://docs.oracle.com/javase/tutorial/uiswing/components/button.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic