• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

ItemListener: checkbox component

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:


Saloon Keeper
Posts: 12002
  • 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.
Posts: 11445
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • 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')
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
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
ScroogeXHTML 9.0 - RTF to HTML5 and XHTML converter
    Bookmark Topic Watch Topic
  • New Topic