| Author |
Checkbox using Swing
|
sahitya
Greenhorn
Joined: May 01, 2008
Posts: 14
|
|
Hi I have few queries regarding Check Box. 1. How to make a checkbox non editable? 2. How to attach an image to the checkbox? Please help.
|
 |
ramesh kancherla
Ranch Hand
Joined: May 01, 2008
Posts: 120
|
|
|
see checkBox constructors
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8434
|
|
Originally posted by sahitya sahitya: 1. How to make a checkbox non editable? 2. How to attach an image to the checkbox?
Check this out.
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
ramesh kancherla
Ranch Hand
Joined: May 01, 2008
Posts: 120
|
|
setEnabled(false) JCheckBox(Icon icon);
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
setIcon(Icon) should also work.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4163
|
|
Originally posted by Rob Prime: setIcon(Icon) should also work.
Actually it doesn't, inasmuch as the icon will replace the default icon, which is the square with the check. This is a partially implemented UI delegate which paints a custom icon in addition to the default one, in the text area of the JCheckBox. A fuller implementation would also need to override setPreferredSize and get/set Size, Maximum/Minimum Size .. (maybe get/setBounds, too.. haven't really thought about it).
|
luck, db
There are no new questions, but there may be new answers.
|
 |
 |
|
|
subject: Checkbox using Swing
|
|
|