File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes  ItemListener: checkbox component Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark " ItemListener: checkbox component" Watch " ItemListener: checkbox component" New topic

ItemListener: checkbox component

Natalie Green

Joined: Dec 15, 2013
Posts: 4
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:


Stephan van Hulst

Joined: Sep 20, 2010
Posts: 4616

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.

The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10824

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')
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

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
I agree. Here's the link:
subject: ItemListener: checkbox component
It's not a secret anymore!