• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Resizing JRadioButton

 
Farhad Rahmati
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it possible to resize JRadio Button?

I mean the circle, not the text. I want to resize the Radio button make it bigger for touch screen application. as it's size it very small


Thanks
 
Rob Spoor
Sheriff
Pie
Posts: 20661
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's an icon, and you can set and get it from the radio button. Well, not "it" - "them". There's at least two of them; play around with the setIcon and setXXXIcon methods.
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, in the default Metal LaF at least, it's just one Icon* which reacts to rollover/pressed/selected states by casting the Component passed to its paintIcon method to a JRadioButton and retrieving its model.

* private class javax.swing.plaf.metal.MetalIconFactory.RadioButtonIcon, obtainable via public static Icon getRadioButtonIcon()

Farhad, one easy way to get a larger circle could be to layer your own Icon, which simply draws a circle of the desired size, with the default Icon. See the HCenter/VCenter alignment sample on
http://tips4java.wordpress.com/2009/03/25/toggle-button-icons/
 
Farhad Rahmati
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke and Rob Spoor

Thank you very much for this information, I was thinking about Icon, but never tried. Yea I will have a go


Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic