wood burning stoves 2.0*
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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: 3615
    
  14

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

Joined: Jul 26, 2007
Posts: 10268
    
    8

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