permaculture playing cards
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
Author

ItemListener: checkbox component

Natalie Green
Greenhorn

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:



Applet

Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 4112
    
  19

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: 10747
    
    9

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


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