aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Checkbox using Swing Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Checkbox using Swing" Watch "Checkbox using Swing" New topic
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
    
    3

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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Checkbox using Swing
 
Similar Threads
Dynamic checkbox JTree
check box
How to insert selectd checkbox record from jsp in table?
how to enable a checkbox through javascript
Tooltips lost when saving object