Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JCheckBox  RSS feed

 
Naveen Kumar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

How to increase the JCheckBox (Box)Size?
Please anybody can help me?

Regards
kumar
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
go to the MetalIconFactory source code, find the static inner class CheckBoxIcon.

copy it, create a separate class, modify/override
protected int getControlSize(){return 13;}
to
protected int getControlSize(){return 26;}//doubles the box size
(or whatever size you want)

now, when you create a checkbox
JCheckBox cbx = new JCheckBox("OK", new CheckBoxIcon());
 
Brian Cole
Author
Ranch Hand
Posts: 947
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not saying that the look-and-feel stuff Mr. Dunn suggests won't work, but I think it might be easier to simply call:

yourCheckBox.setIcon(new ImageIcon("biggerBox.gif")); //or some other Icon
yourCheckBox.setSelectedIcon(new ImageIcon("biggerCheckedBox.gif"));

That's kind of what those methods are for.
[ January 09, 2007: Message edited by: Brian Cole ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!