com.samskivert.swing.util
Class ButtonUtil

java.lang.Object
  extended by com.samskivert.swing.util.ButtonUtil

public class ButtonUtil
extends Object

Utilities for buttons.


Nested Class Summary
protected static class ButtonUtil.ButtonConfigBinding
          Used for bindToProperty(java.lang.String, com.samskivert.util.PrefsConfig, javax.swing.AbstractButton, boolean).
 
Field Summary
protected static ActionListener _toggler
          Our lazily-initialized toggling action listener.
 
Constructor Summary
ButtonUtil()
           
 
Method Summary
static void bindToProperty(String property, PrefsConfig config, AbstractButton button, boolean defval)
          Binds the supplied button to the named boolean property in the supplied config repository.
static ActionListener cycleToProperty(String property, PrefsConfig config, AbstractButton button, int[] values)
          Configure the specified button to cause the specified property to cycle through the specified values whenever the button is pressed.
static void setToggling(AbstractButton b)
          Set the specified button such that it alternates between being selected and not whenever it is pushed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_toggler

protected static ActionListener _toggler
Our lazily-initialized toggling action listener.

Constructor Detail

ButtonUtil

public ButtonUtil()
Method Detail

setToggling

public static void setToggling(AbstractButton b)
Set the specified button such that it alternates between being selected and not whenever it is pushed.


bindToProperty

public static void bindToProperty(String property,
                                  PrefsConfig config,
                                  AbstractButton button,
                                  boolean defval)
Binds the supplied button to the named boolean property in the supplied config repository. When the button is pressed, it will update the config property and when the config property is changed (by the button or by other means) it will update the selected state of the button. When the button is made non-visible, it will be unbound to the config's property and rebound again if it is once again visible.


cycleToProperty

public static ActionListener cycleToProperty(String property,
                                             PrefsConfig config,
                                             AbstractButton button,
                                             int[] values)
Configure the specified button to cause the specified property to cycle through the specified values whenever the button is pressed.



Copyright © 2000-2008 Michael Bayne. All Rights Reserved.