jas2.util.multibuttontoolbar
Class MultiButtonGroup
- java.lang.Object
-
- jas2.util.multibuttontoolbar.MultiButtonGroup
-
public class MultiButtonGroup extends java.lang.ObjectA MultiButtonGroup manages which of the AbstractButtons in it is visible at any given time.
-
-
Constructor Summary
Constructors Constructor and Description MultiButtonGroup(javax.swing.AbstractButton b)Creates a MultiButtonGroup with one component button, which is set to be the visible button.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(javax.swing.AbstractButton b)Adds the button to the group.java.util.EnumerationgetElements()Return all the buttons that are participating in this group.javax.swing.AbstractButtongetVisibleButton(boolean needMouseListener)Return the visible button.booleanisVisibleButton(javax.swing.AbstractButton b)Returns whether the button is the visible button.voidremove(javax.swing.AbstractButton b)Removes the button from the group.voidsetPositionInToolBar(int pos)voidsetToolBar(MultiToolBar tb)voidsetVisibleButton(javax.swing.AbstractButton b)Sets the button to be the visible button.
-
-
-
Constructor Detail
-
MultiButtonGroup
public MultiButtonGroup(javax.swing.AbstractButton b)
Creates a MultiButtonGroup with one component button, which is set to be the visible button. This ensures that there is always exactly one button visible (as opposed to a ButtonGroup, in which there can be either 0 or 1 buttons selected.
-
-
Method Detail
-
add
public void add(javax.swing.AbstractButton b)
Adds the button to the group.
-
remove
public void remove(javax.swing.AbstractButton b)
Removes the button from the group. Removing the only button is forbidden. Removing the visible button (which is allowed if there is more than one button in the group) causes the first button in the MultiButtonGroup to become the visible button.
-
getVisibleButton
public javax.swing.AbstractButton getVisibleButton(boolean needMouseListener)
Return the visible button.- Parameters:
needMouseListener- true if the visible button is being put in a toolbar that will enable it to pop up a menu that allows the visible button to be switched, false otherwise
-
setVisibleButton
public void setVisibleButton(javax.swing.AbstractButton b)
Sets the button to be the visible button. Note that there is no setButtonVisible method since one button must be selected at all times, which means that the visible property should not be thought of as something that can be turned on/off, but that can only be transferred.
-
isVisibleButton
public boolean isVisibleButton(javax.swing.AbstractButton b)
Returns whether the button is the visible button.
-
getElements
public java.util.Enumeration getElements()
Return all the buttons that are participating in this group.
-
setPositionInToolBar
public void setPositionInToolBar(int pos)
-
setToolBar
public void setToolBar(MultiToolBar tb)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG