Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #3420 > unrolled thread

Size of a radiobutton

Started by"Andre Rothe" <andre.rothe@THRWHITE.remove-dii-this>
First post2011-04-27 15:44 +0000
Last post2011-04-27 15:44 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.lang.java.gui


Contents

  Size of a radiobutton "Andre Rothe" <andre.rothe@THRWHITE.remove-dii-this> - 2011-04-27 15:44 +0000
    Re: Size of a radiobutton "Frank Meyer" <frank.meyer@THRWHITE.remove-dii-this> - 2011-04-27 15:44 +0000
    Re: Size of a radiobutton "tar" <tar@THRWHITE.remove-dii-this> - 2011-04-27 15:44 +0000

#3420 — Size of a radiobutton

From"Andre Rothe" <andre.rothe@THRWHITE.remove-dii-this>
Date2011-04-27 15:44 +0000
SubjectSize of a radiobutton
Message-ID<fumvgj$4gk$1@aioe.org>
  To: comp.lang.java.gui
Hi,

Is there a possibility to get the size of a radio button? You can use 
getWidth() and getHeight() of a JRadioButton, but this comes from the 
component, which will be resized depending on the layout you use. I need 
the size of the clickable unchangable circle (which size depends on the 
look and feel).

Thanx
Andre

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#3423

From"Frank Meyer" <frank.meyer@THRWHITE.remove-dii-this>
Date2011-04-27 15:44 +0000
Message-ID<480f4bea$0$6781$9b4e6d93@newsspool2.arcor-online.net>
In reply to#3420
  To: comp.lang.java.gui
Andre Rothe wrote:
> the size of the clickable unchangable circle

Hi Andre,
this is the radiobutton-icon.
Below is a code-snippet.
Hope this helps
Frank

import javax.swing.*;

public class ButtonIconResolver {
  /**
   * extracted from BasicRadioButtonUI
   * @param b
   * @return
   */
  public static Icon getIcon(JRadioButton b) {
   ButtonModel model = b.getModel();
   Icon icon = b.getIcon();
   if (icon != null) {
    if (!model.isEnabled()) {
     if (model.isSelected()) {
      icon = b.getDisabledSelectedIcon();
     } else {
      icon = b.getDisabledIcon();
     }
    } else if (model.isPressed() && model.isArmed()) {
     icon = b.getPressedIcon();
     if (icon == null) {
      icon = b.getSelectedIcon();
     }
    } else if (model.isSelected()) {
     if (b.isRolloverEnabled() && model.isRollover()) {
      icon = b.getRolloverSelectedIcon();
      if (icon == null) {
       icon = b.getSelectedIcon();
      }
     } else {
      icon = b.getSelectedIcon();
     }
    } else if (b.isRolloverEnabled() && model.isRollover()) {
     icon = b.getRolloverIcon();
    }
    if (icon == null) {
     icon = b.getIcon();
    }
    return icon;
   } else {
    return UIManager.getIcon("RadioButton.icon");
   }
  }
}

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3428

From"tar" <tar@THRWHITE.remove-dii-this>
Date2011-04-27 15:44 +0000
Message-ID<ymifxtagcjq.fsf@blackcat.isi.edu>
In reply to#3420
  To: comp.lang.java.gui
Andre Rothe <andre.rothe@imise.uni-leipzig.de> writes:

> Hi,
> 
> Is there a possibility to get the size of a radio button? You can use
> getWidth() and getHeight() of a JRadioButton, but this comes from the
> component, which will be resized depending on the layout you use. I need
> the size of the clickable unchangable circle (which size depends on the
> look and feel).

But why do you want to get that?

Remember that, the native behavior (for example, on the Mac and Windows)
of check boxes and radio buttons is that they are active if the icon OR
the text label is clicked.  This behavior is, of course, highly useful
for user productivity, since it gives a much larger target to hit with
the mouse button.  (See Fitt's law, e.g.,
<http://en.wikipedia.org/wiki/Fitts'_law>,
<http://www.asktog.com/basics/firstPrinciples.html>) 

Mac users, in particular, would tend to notice that the behavior isn't
quite what they expected.  But I suppose that this 

-- 
Thomas A. Russ,  USC/Information Sciences Institute

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web