All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sas.visuals
Class BaseButton

    com.sas.visuals.BaseButton

All Implemented Interfaces:
  ActionSource, CompositeInterface, ContainerInterface, com.sas.awt.print.PrintableInterface, VisualInterface, com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, com.sas.ComponentInterface, com.sas.DesignTimeDropTargetInterface, com.sas.lang.StringDataInterface, com.sas.LinkPropertiesInterface, com.sas.ModelInterface, com.sas.PublicClonable, ValidatorInterface, com.sas.ViewInterface, Alignment, MultipleValueEventSourceInterface, ResizeToFitInterface, java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.ItemListener, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

Direct Known Subclasses:
  PushButton, ToggleButton

    public abstract class BaseButton

implements ActionSource, java.awt.ItemSelectable, java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.event.FocusListener, com.sas.lang.StringDataInterface, Alignment, ResizeToFitInterface, com.sas.PublicClonable

BaseButton is an abstract class for creating a button. The button can display both a label and an IconInterface object arranged in several different alignments. It sends an ActionEvent when pressed and an ItemEvent if selected.
The interaction between the Models and Listeners can be described as follows. There is essentially three parts of the BaseButton. The visual component, Button, the Listener, and the Model. The Listener listens for user events on the Button. The Model listens to the Listener and applies state changes to the Model. Then the visual Button component listens to the Model for the state changes and applies it to the Button.
Notes:

- VERSION 2 CHANGE Setting the text property now sets the item property also. Previously the item property could be set first and then the text to have two different values for each. To have a different value for the text, use a displayTransform.
- The defaultIcon must be set for any IconInterface objects to be painted.
- All IconInterface objects should have the same preferredSize.

See Also:
  `PushButton`, `ToggleButton`, `ButtonListenerInterface`, `ButtonModelInterface`, `DefaultButtonListener`, `DefaultButtonModel`, Serialized Form

Field Summary
`protected java.lang.String` | `actionCommand`
`protected java.awt.event.ActionListener` | `actionListenerList`
`protected boolean` | `borderPainted`
`static int` | `BOTTOM`
`protected ButtonListenerInterface` | `buttonListener`
`protected ButtonModelInterface` | `buttonModel`
`protected java.awt.Insets` | `currentInsets`
`protected com.sas.visuals.IconInterface` | `defaultIcon`
`protected com.sas.visuals.IconInterface` | `disabledIcon`
`protected com.sas.util.transforms.TransformInterface` | `displayTransform`
`protected int` | `focusGap`
`protected boolean` | `focusPainted`
`protected int` | `gap`
`protected boolean` | `hasFocus`
`protected int` | `horizontalAlignment`
`protected int` | `horizontalTextAlignment`
`protected java.lang.Object` | `item`
`protected java.awt.event.ItemListener` | `itemListenerList`
`static int` | `LEFT`
`protected com.sas.visuals.IconInterface` | `pressedIcon`
`static java.lang.String` | `RB_KEY`
`protected boolean` | `resizeToFit`
`static int` | `RIGHT`
`protected com.sas.visuals.IconInterface` | `rolloverIcon`
`protected com.sas.visuals.IconInterface` | `selectedIcon`
`protected java.lang.String` | `text`
`protected int` | `textPosition`
`static int` | `TOP`
`protected boolean` | `updateItem`
`protected boolean` | `updateText`
`protected int` | `verticalAlignment`
`protected int` | `verticalTextAlignment`

Fields inherited from interface com.sas.visuals.Alignment
`BEGIN, CENTER, END`

Constructor Summary
`BaseButton()` Default Constructor

Method Summary
`void` | `actionPerformed(java.awt.event.ActionEvent event)` Invoked when the buttonModel sends an ActionEvent.
`void` | `addActionListener(java.awt.event.ActionListener listener)` Add an ActionListener to listen for ActionEvents on the BaseButton
`void` | `addItemListener(java.awt.event.ItemListener listener)` Add an ItemListener to listen for ItemEvents on the BaseButton
`void` | `addNotify()` Makes this Component displayable by connecting it to a native screen resource.
`protected void` | `buttonModelArmed(ButtonModelInterface btnModel)` Handle change in buttonModel armed property.
`protected void` | `buttonModelDisabled(ButtonModelInterface btnModel)` Handle change in buttonModel disabled property.
`protected void` | `buttonModelPressed(ButtonModelInterface btnModel)` Handle change in buttonModel pressed property.
`protected void` | `buttonModelRollover(ButtonModelInterface btnModel)` Handle change in buttonModel rollover property.
`protected void` | `buttonModelSelected(ButtonModelInterface btnModel)` Handle change in buttonModel selected property.
`java.lang.Object` | `clone()` Returns a BaseButton clone of the original BaseButton component called upon
`java.awt.Dimension` | `computePreferredSize()` Compute the preferred size.
`void` | `detachModel(com.sas.ModelInterface model)` Detaches model from the BaseButton
`void` | `focusGained(java.awt.event.FocusEvent evt)` Invoked when a component gains the keyboard focus.
`void` | `focusLost(java.awt.event.FocusEvent evt)` Invoked when a component loses the keyboard focus.
`java.lang.String` | `getActionCommand()` Get the actionCommand to be set on an ActionEvent when it is sent.
`ButtonListenerInterface` | `getButtonListener()` Get the ButtonListenerInterface object that controls the state of the ButtonModelInterface object.
`ButtonModelInterface` | `getButtonModel()` Get the ButtonModelInterface object that contains the state of the BaseButton.
`protected java.awt.Dimension` | `getContentSize(java.awt.Dimension textSize, java.awt.Dimension iconSize)` Get the size of the content to be displayed within the BaseButton.
`com.sas.visuals.IconInterface` | `getDefaultIcon()` Get the default IconInterface object displayed normally.
`com.sas.visuals.IconInterface` | `getDisabledIcon()` Get the IconInterface displayed if the buttonModel state is "disabled".
`com.sas.util.transforms.TransformInterface` | `getDisplayTransform()` Get the TransformInterface used to transform the model information to the format and type to be displayed.
`static com.sas.beans.ExtendedBeanInfo` | `getExtendedBeanInfo()`
`int` | `getFocusGap()` Get the pixel amount of gap between the border and the focus rectangle.
`int` | `getHorizontalAlignment()` Get the horizontal alignment of the content of the button.
`int` | `getHorizontalTextAlignment()` Get the horizontal alignment of the text displayed on the button.
`int` | `getIconTextGap()` Get the gap between the IconInterface object and where the text is drawn.
`java.awt.Insets` | `getInsets()` Get the Insets of the BaseButton.
`java.lang.Object` | `getItem()` Get the item that with the displayTransform is displayed on the button.
`char` | `getKeyAccelerator()` Get the key accelerator used to trigger this button.
`com.sas.visuals.IconInterface` | `getPressedIcon()` Get the IconInterface displayed when the buttonModel state is "pressed".
`java.util.Vector` | `getRequiredInterfaces()` Returns the required interfaces Vector for this component.
`com.sas.visuals.IconInterface` | `getRolloverIcon()` Get the IconInterface displayed when the buttonModel state is "rollover".
`com.sas.visuals.IconInterface` | `getSelectedIcon()` Get the IconInterface displayed when the buttonModel state is "selected".
`java.lang.Object[]` | `getSelectedObjects()` Get the item value in a one-element array of Objects.
`java.lang.String` | `getText()` Get the text displayed in the button.
`int` | `getTextPosition()` Get the position the text is displayed relative to the defaultIcon.
`int` | `getVerticalAlignment()` Get the vertical alignment of the content displayed on the button.
`int` | `getVerticalTextAlignment()` Get the vertical alignment of the text displayed on the button.
`boolean` | `isBorderPainted()` Get if the Border object is painted.
`boolean` | `isFocusPainted()` Get if the focus rectangle is painted.
`boolean` | `isFocusTraversable()` Get that the button is FocusTraversable.
`boolean` | `isResizeToFit()` Get if the button will resizeToFit if the contentSize changes.
`boolean` | `isSelected()` Get the selected state of the ButtonModelInterface object
`void` | `itemStateChanged(java.awt.event.ItemEvent event)` Invoked when the selected state of the buttonModel is changed.
`protected void` | `processActionEvent(java.awt.event.ActionEvent e)` Process ActionEvents sent from the button to its listeners
`protected void` | `processEvent(java.awt.AWTEvent e)` Process events
`protected void` | `processItemEvent(java.awt.event.ItemEvent e)` Process ItemEvents sent from the button to its listeners
`void` | `propertyChange(java.beans.PropertyChangeEvent event)` Invoked when a PropertyChangeEvent occurs.
`void` | `refresh(com.sas.ModelInterface model)` Refresh the model attached to the BaseButton
`protected void` | `refreshItem(java.lang.Object newItem)` Refresh the contents displayed with the new Item value.
`void` | `removeActionListener(java.awt.event.ActionListener listener)` Remove an ActionListener from the list of listeners to be notified of an ActionEvent.
`void` | `removeItemListener(java.awt.event.ItemListener listener)` Remove an ItemListener from the list of listeners to be notified of an ItemEvent.
`void` | `resizeToFit()` Resize the button to fit the preferred size.
`void` | `setActionCommand(java.lang.String cmd)` Set the actionCommand to be sent out when an ActionEvent is triggered.
`void` | `setBorderPainted(boolean paint)` Set whether the border is painted.
`void` | `setBounds(int x, int y, int width, int height)` Set the bounds of the BaseButton.
`void` | `setButtonListener(ButtonListenerInterface btnListener)` Set the buttonListener for the BaseButton.
`void` | `setButtonModel(ButtonModelInterface model)` Set the buttonModel for the BaseButton.
`void` | `setDefaultIcon(com.sas.visuals.IconInterface defaultImg)` Set the default IconInterface object.
`void` | `setDefaultValues()` Set the default internal values for the BaseButton.
`void` | `setDisabledIcon(com.sas.visuals.IconInterface disabledImg)` Set the IconInterface object to be painted when the button is disabled.
`void` | `setDisplayTransform(com.sas.util.transforms.TransformInterface transform)` Set the Transform to be used to display the "item" property.
`void` | `setEnabled(boolean b)` Set the button enabled state.
`void` | `setFocusGap(int g)` Set the gap between the border and the focus rectangle.
`void` | `setFocusPainted(boolean paint)` Set whether the focus rectangle should be painted.
`void` | `setFont(java.awt.Font f)` Set the font to be used to display the text of the BaseButton.
`void` | `setHorizontalAlignment(int horizontalAlign)` Set the horizontal alignment of the content of the BaseButton.
`void` | `setHorizontalTextAlignment(int hTextAlign)` Set the horizontal alignment of the text of the BaseButton.
`void` | `setIconTextGap(int g)` Set the pixel gap between the IconInterface object and the text.
`void` | `setInsets(java.awt.Insets insets)` Set the insets between the edge of the button and the content of the button.
`void` | `setItem(java.lang.Object newItem)` Set the item object that is transformed by the displayTransform for display as the content of the BaseButton.
`void` | `setKeyAccelerator(char key)` Set the key to that when pressed triggers the BaseButton.
`void` | `setPressedIcon(com.sas.visuals.IconInterface pressedImg)` Set the IconInterface object to be painted when the BaseButton state is pressed.
`void` | `setResizeToFit(boolean resize)` Set whether the BaseButton should be resized automatically to fit the contents when they are changed.
`void` | `setRolloverIcon(com.sas.visuals.IconInterface rolloverImg)` Set the IconInterface object to be painted when the BaseButton state is rollover.
`void` | `setSelected(boolean selected)` Set the button state to selected.
`void` | `setSelectedIcon(com.sas.visuals.IconInterface selectedImg)` Set the IconInterface object to be painted when the BaseButton state is selected.
`void` | `setText(java.lang.String txt)` Set the text to be displayed on the BaseButton.
`void` | `setTextPosition(int position)` Set the position the text is displayed relative to the defaultIcon.
`void` | `setVerticalAlignment(int verticalAlign)` Set the vertical alignment of the content displayed on the button.
`void` | `setVerticalTextAlignment(int vTextAlign)` Set the vertical alignment of the text displayed on the button.

Methods inherited from class com.sas.visuals.CompositeContainer
`getDefaultHeight, getDefaultWidth, setDefaultHeight, setDefaultWidth`

Methods inherited from class com.sas.awt.ContainerContainerComponent
`dragEnter, dragLeave, dragOver, drop, getContainerInterfaceSupportInfo, getErrorHandler, getValidator, isIDEDnDDropBarrier, isIDEDnDDropTarget, isValid, removeNotify, setContainerInterfaceSupportInfo, setErrorHandler, setIDEDnDDropBarrier, setIDEDnDDropTarget, setInsets, setValidator, superAddNotify, superGetInsets, superRemoveNotify, superSetDefaultValues`

Methods inherited from class com.sas.awt.ContainerVisualComponent
`addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachModel, attachView, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getBackgroundColor, getBorder, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getFont, getForegroundColor, getHeight, getHorizontalPosition, getLinkInfo, getMinimumSize, getModelInterface, getPageBounds, getPreferredSize, getPrePainter, getPrintOptionsPanel, getVerticalPosition, getViewInterfaceSupportInfo, getVisualInterfaceSupportInfo, getWidth, initialize, initializeComponent, isDesignTime, isEnabled, isFocus, isLinked, isTransparent, isVisible, pageExists, paint, print, printFinalize, printInitialize, queryLinks, queryLinks, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setBackgroundColor, setBorder, setComponentDescription, setComponentSupportInfo, setFocus, setForegroundColor, setHeight, setHorizontalPosition, setLinkInfo, setModelInterface, setPreferredSize, setPrePainter, setRequiredInterfaces, setTransparent, setVerticalPosition, setViewInterfaceSupportInfo, setVisible, setVisualInterfaceSupportInfo, setWidth, superGetFont, superGetMinimumSize, superGetPreferredSize, superIsEnabled, superIsVisible, superPaint, superSetBounds, superSetEnabled, superSetFont, superSetVisible, superUpdate, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, update, validateObject`

Methods inherited from interface com.sas.awt.ContainerInterface
`getComponents, getLayout, invalidate, setLayout, validate`

Methods inherited from interface com.sas.awt.VisualInterface
`getBackgroundColor, getBorder, getFont, getForegroundColor, getHeight, getHorizontalPosition, getMinimumSize, getPreferredSize, getPrePainter, getVerticalPosition, getVisualInterfaceSupportInfo, getWidth, isEnabled, isFocus, isTransparent, isVisible, setBackgroundColor, setBorder, setFocus, setForegroundColor, setHeight, setHorizontalPosition, setPreferredSize, setPrePainter, setTransparent, setVerticalPosition, setVisible, setVisualInterfaceSupportInfo, setWidth, superGetFont, superGetMinimumSize, superGetPreferredSize, superIsEnabled, superIsVisible, superPaint, superSetBounds, superSetEnabled, superSetFont, superSetVisible, superUpdate`

Field Detail

### RB_KEY

    public static final java.lang.String RB_KEY

See Also:
  Constant Field Values

### TOP

    public static final int TOP

See Also:
  Constant Field Values

### BOTTOM

    public static final int BOTTOM

See Also:
  Constant Field Values

### LEFT

    public static final int LEFT

See Also:
  Constant Field Values

### RIGHT

    public static final int RIGHT

See Also:
  Constant Field Values

### defaultIcon

    protected com.sas.visuals.IconInterface defaultIcon

### disabledIcon

    protected com.sas.visuals.IconInterface disabledIcon

### pressedIcon

    protected com.sas.visuals.IconInterface pressedIcon

### rolloverIcon

    protected com.sas.visuals.IconInterface rolloverIcon

### selectedIcon

    protected com.sas.visuals.IconInterface selectedIcon

### item

    protected java.lang.Object item

### actionCommand

    protected java.lang.String actionCommand

### text

    protected java.lang.String text

### textPosition

    protected int textPosition

### gap

    protected int gap

### focusGap

    protected int focusGap

### currentInsets

    protected java.awt.Insets currentInsets

### displayTransform

    protected com.sas.util.transforms.TransformInterface displayTransform

### verticalAlignment

    protected int verticalAlignment

### horizontalAlignment

    protected int horizontalAlignment

### verticalTextAlignment

    protected int verticalTextAlignment

### horizontalTextAlignment

    protected int horizontalTextAlignment

### resizeToFit

    protected boolean resizeToFit

### focusPainted

    protected boolean focusPainted

### borderPainted

    protected boolean borderPainted

### hasFocus

    protected boolean hasFocus

### buttonListener

    protected ButtonListenerInterface buttonListener

### buttonModel

    protected ButtonModelInterface buttonModel

### updateText

    protected transient boolean updateText

### updateItem

    protected transient boolean updateItem

### actionListenerList

    protected transient java.awt.event.ActionListener actionListenerList

### itemListenerList

    protected transient java.awt.event.ItemListener itemListenerList

Constructor Detail

### BaseButton

    public BaseButton()

  Default Constructor

Method Detail

### getExtendedBeanInfo

    public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()

### actionPerformed

    public void actionPerformed(java.awt.event.ActionEvent event)

  Invoked when the buttonModel sends an ActionEvent.

  Specified by:
    `actionPerformed` in interface `java.awt.event.ActionListener`
  Parameters:
    `event` - the ActionEvent from the buttonModel

### addActionListener

    public void addActionListener(java.awt.event.ActionListener listener)

  Add an ActionListener to listen for ActionEvents on the BaseButton

  Specified by:
    `addActionListener` in interface `ActionSource`
  Parameters:
    `listener` - the ActionListener to send the ActionEvents to.
  See Also:
    `ActionListener`, `removeActionListener(java.awt.event.ActionListener)`

### addItemListener

    public void addItemListener(java.awt.event.ItemListener listener)

  Add an ItemListener to listen for ItemEvents on the BaseButton

  Specified by:
    `addItemListener` in interface `java.awt.ItemSelectable`
  Parameters:
    `listener` - the ItemListener to send the ItemEvents to.
  See Also:
    `ItemListener`, `removeItemListener(java.awt.event.ItemListener)`

### addNotify

    public void addNotify()

  Makes this Component displayable by connecting it to a native screen resource. This method is called internally by the toolkit and should not be called directly by programs. Overridden to call resizeToFit() to resize a component after it has been added to its parent.

  Specified by:
    `addNotify` in interface `ContainerInterface`
  Overrides:
    `addNotify` in class `ContainerContainerComponent`

### buttonModelArmed

    protected void buttonModelArmed(ButtonModelInterface btnModel)

  Handle change in buttonModel armed property. Repaint the button if buttonModel is not disabled. Override to change the behavior when the model armed property changes.

  Parameters:
    `btnModel` - the buttonModel that changed.

### buttonModelDisabled

    protected void buttonModelDisabled(ButtonModelInterface btnModel)

  Handle change in buttonModel disabled property. Override to change the behavior when the model disabled property changes.

  Parameters:
    `btnModel` - the buttonModel that changed.

### buttonModelPressed

    protected void buttonModelPressed(ButtonModelInterface btnModel)

  Handle change in buttonModel pressed property. Repaint the button if buttonModel is not disabled. Override to change the behavior when the model pressed property changes.

  Parameters:
    `btnModel` - the buttonModel that changed.

### buttonModelRollover

    protected void buttonModelRollover(ButtonModelInterface btnModel)

  Handle change in buttonModel rollover property. Repaint the button when the following conditions are all false:

        buttonModel.isDisabled()
        getDefaultIcon() == null
        getRolloverIcon() == null
        btnModel.isSelected() && getSelectedIcon() != null
        btnModel.isPressed() && getPressedIcon() != null

  Override to change the behavior when the model rollover property changes.

  Parameters:
    `btnModel` - the Button Model that changed.

### buttonModelSelected

    protected void buttonModelSelected(ButtonModelInterface btnModel)

  Handle change in buttonModel selected property. Repaint the button if buttonModel is not disabled. Override to change the behavior when the model selected property changes.

  Parameters:
    `btnModel` - the Button Model that changed.

### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

  Returns a BaseButton clone of the original BaseButton component called upon

  Specified by:
    `clone` in interface `com.sas.PublicClonable`
  Overrides:
    `clone` in class `ContainerContainerComponent`
  Returns:
    a clone object which is a LabelView
  Throws:
    `java.lang.CloneNotSupportedException` - if it component cannot be cloned.

### focusGained

    public void focusGained(java.awt.event.FocusEvent evt)

  Invoked when a component gains the keyboard focus. Causes a repaint and sets hasFocus to true.

  Specified by:
    `focusGained` in interface `java.awt.event.FocusListener`
  See Also:
    `FocusListener.focusGained(java.awt.event.FocusEvent)`, `focusLost(java.awt.event.FocusEvent)`

### focusLost

    public void focusLost(java.awt.event.FocusEvent evt)

  Invoked when a component loses the keyboard focus. Causes a repaint and sets hasFocus to false.

  Specified by:
    `focusLost` in interface `java.awt.event.FocusListener`
  See Also:
    `FocusListener.focusLost(java.awt.event.FocusEvent)`, `focusGained(java.awt.event.FocusEvent)`

### getActionCommand

    public java.lang.String getActionCommand()

  Get the actionCommand to be set on an ActionEvent when it is sent.

  Returns:
    the actionCommand or the text if the actionCommand is null.
  See Also:
    `setActionCommand(java.lang.String)`, `ActionEvent.getActionCommand()`

### getButtonListener

    public ButtonListenerInterface getButtonListener()

  Get the ButtonListenerInterface object that controls the state of the ButtonModelInterface object.

  Returns:
    buttonListener for the BaseButton
  See Also:
    `setButtonListener(com.sas.visuals.ButtonListenerInterface)`

### getButtonModel

    public ButtonModelInterface getButtonModel()

  Get the ButtonModelInterface object that contains the state of the BaseButton.

  Returns:
    the buttonModel for the BaseButton
  See Also:
    `setButtonModel(com.sas.visuals.ButtonModelInterface)`

### getContentSize

    protected java.awt.Dimension getContentSize(java.awt.Dimension textSize,
                                                java.awt.Dimension iconSize)

  Get the size of the content to be displayed within the BaseButton.

  Parameters:
    `textSize` - the size of the text to be displayed
    `iconSize` - the size of the defaultIcon to be displayed
  Returns:
    the size of the content to be displayed.

### getDefaultIcon

    public com.sas.visuals.IconInterface getDefaultIcon()

  Get the default IconInterface object displayed normally. If this is not set then no IconInterface will be displayed.

  Returns:
    the defaultIcon displayed
  See Also:
    `setDefaultIcon(com.sas.visuals.IconInterface)`

### getDisabledIcon

    public com.sas.visuals.IconInterface getDisabledIcon()

  Get the IconInterface displayed if the buttonModel state is "disabled".

  Returns:
    the disabledIcon displayed
  See Also:
    `setDisabledIcon(com.sas.visuals.IconInterface)`

### getDisplayTransform

    public com.sas.util.transforms.TransformInterface getDisplayTransform()

  Get the TransformInterface used to transform the model information to the format and type to be displayed.

  See Also:
    `setDisplayTransform(com.sas.util.transforms.TransformInterface)`

### getFocusGap

    public int getFocusGap()

  Get the pixel amount of gap between the border and the focus rectangle. Also can be used as the gap between the content and the border.

  Returns:
    the pixel amount of focus gap
  See Also:
    `setFocusGap(int)`

### getIconTextGap

    public int getIconTextGap()

  Get the gap between the IconInterface object and where the text is drawn.

  Returns:
    the pixel amount of gap between the icon and text
  See Also:
    `setIconTextGap(int)`

### getInsets

    public java.awt.Insets getInsets()

  Get the Insets of the BaseButton. Insets are set in reference to the border. If the Insets lie within the border then the Insets are measured from the the border to the inside of the button to how many pixels chosen for the Insets. If the Insets are specified and lay outside the border, then the Insets are set to the border.

  Specified by:
    `getInsets` in interface `ContainerInterface`
  Overrides:
    `getInsets` in class `ContainerContainerComponent`
  Returns:
    the larger Inset values between the Insets set on the button and the border Insets.

### getItem

    public java.lang.Object getItem()

  Get the item that with the displayTransform is displayed on the button.

  Returns:
    the item object
  See Also:
    `SelectableInterface.getItem()`, `setItem(java.lang.Object)`

### getText

    public java.lang.String getText()

  Get the text displayed in the button.

  Specified by:
    `getText` in interface `com.sas.lang.StringDataInterface`
  Returns:
    the text displayed on the button
  See Also:
    `StringDataInterface.getText()`, `setText(java.lang.String)`

### getHorizontalAlignment

    public int getHorizontalAlignment()

  Get the horizontal alignment of the content of the button.

  Returns:
    the alignment: LEFT(BEGIN), CENTER, or RIGHT(END)
  See Also:
    `setHorizontalAlignment(int)`

### getHorizontalTextAlignment

    public int getHorizontalTextAlignment()

  Get the horizontal alignment of the text displayed on the button.

  Returns:
    the alignment: LEFT(BEGIN), CENTER, or RIGHT(END)
  See Also:
    `setHorizontalTextAlignment(int)`

### getKeyAccelerator

    public char getKeyAccelerator()

  Get the key accelerator used to trigger this button. CURRENTLY only SPACEBAR triggers a button when it has focus.

  Returns:
    the character used to trigger the button
  See Also:
    `setKeyAccelerator(char)`

### computePreferredSize

    public java.awt.Dimension computePreferredSize()

  Compute the preferred size.

  Specified by:
    `computePreferredSize` in interface `VisualInterface`
  Overrides:
    `computePreferredSize` in class `ContainerVisualComponent`
  Returns:
    the minimum size
  See Also:
    `VisualInterface.computePreferredSize()`

### getPressedIcon

    public com.sas.visuals.IconInterface getPressedIcon()

  Get the IconInterface displayed when the buttonModel state is "pressed".

  Returns:
    the pressedIcon
  See Also:
    `setPressedIcon(com.sas.visuals.IconInterface)`

### getRequiredInterfaces

    public java.util.Vector getRequiredInterfaces()

  Returns the required interfaces Vector for this component.

  Specified by:
    `getRequiredInterfaces` in interface `com.sas.ViewInterface`
  Overrides:
    `getRequiredInterfaces` in class `ContainerVisualComponent`
  Returns:
    the required interfaces Vector for this component.
  See Also:
    `ViewInterface.getRequiredInterfaces()`

### getRolloverIcon

    public com.sas.visuals.IconInterface getRolloverIcon()

  Get the IconInterface displayed when the buttonModel state is "rollover".

  Returns:
    the rolloverIcon
  See Also:
    `setRolloverIcon(com.sas.visuals.IconInterface)`

### getSelectedIcon

    public com.sas.visuals.IconInterface getSelectedIcon()

  Get the IconInterface displayed when the buttonModel state is "selected".

  Returns:
    the selectedIcon
  See Also:
    `setSelectedIcon(com.sas.visuals.IconInterface)`

### getSelectedObjects

    public java.lang.Object[] getSelectedObjects()

  Get the item value in a one-element array of Objects.

  Specified by:
    `getSelectedObjects` in interface `java.awt.ItemSelectable`
  Returns:
    the selected objects
  See Also:
    `ItemSelectable`

### getTextPosition

    public int getTextPosition()

  Get the position the text is displayed relative to the defaultIcon.

  Returns:
    the textPosition: TOP, BOTTOM, LEFT, or RIGHT.
  See Also:
    `setTextPosition(int)`

### getVerticalAlignment

    public int getVerticalAlignment()

  Get the vertical alignment of the content displayed on the button.

  Returns:
    the alignment: TOP, CENTER, or BOTTOM
  See Also:
    `setVerticalAlignment(int)`

### getVerticalTextAlignment

    public int getVerticalTextAlignment()

  Get the vertical alignment of the text displayed on the button.

  Returns:
    the alignment: TOP, CENTER, or BOTTOM
  See Also:
    `setVerticalTextAlignment(int)`

### isBorderPainted

    public boolean isBorderPainted()

  Get if the Border object is painted.

  Returns:
    true if the border is painted; false otherwise
  See Also:
    `setBorderPainted(boolean)`

### isFocusPainted

    public boolean isFocusPainted()

  Get if the focus rectangle is painted.

  Returns:
    true if the focus rectangle is painted; false otherwise
  See Also:
    `isFocusPainted()`

### isFocusTraversable

    public boolean isFocusTraversable()

  Get that the button is FocusTraversable.

  Overrides:
    `isFocusTraversable` in class `java.awt.Component`
  Returns:
    true, the button is FocusTraversable
  See Also:
    `Component.isFocusTraversable()`

### isResizeToFit

    public boolean isResizeToFit()

  Get if the button will resizeToFit if the contentSize changes.

  Specified by:
    `isResizeToFit` in interface `ResizeToFitInterface`
  Returns:
    true the button will resize to fit the content; false otherwise.
  See Also:
    `ResizeToFitInterface.isResizeToFit()`, `setResizeToFit(boolean)`

### isSelected

    public boolean isSelected()

  Get the selected state of the ButtonModelInterface object

  Returns:
    true, the button is selected; false otherwise.
  See Also:
    `setSelected(boolean)`

### itemStateChanged

    public void itemStateChanged(java.awt.event.ItemEvent event)

  Invoked when the selected state of the buttonModel is changed.

  Specified by:
    `itemStateChanged` in interface `java.awt.event.ItemListener`
  See Also:
    `ItemListener.itemStateChanged(java.awt.event.ItemEvent)`

### processEvent

    protected void processEvent(java.awt.AWTEvent e)

  Process events

  Overrides:
    `processEvent` in class `java.awt.Container`

### processActionEvent

    protected void processActionEvent(java.awt.event.ActionEvent e)

  Process ActionEvents sent from the button to its listeners

### processItemEvent

    protected void processItemEvent(java.awt.event.ItemEvent e)

  Process ItemEvents sent from the button to its listeners

### propertyChange

    public void propertyChange(java.beans.PropertyChangeEvent event)

  Invoked when a PropertyChangeEvent occurs.

  Specified by:
    `propertyChange` in interface `java.beans.PropertyChangeListener`
  Overrides:
    `propertyChange` in class `ContainerVisualComponent`
  See Also:
    `PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)`

### detachModel

    public void detachModel(com.sas.ModelInterface model)

  Detaches model from the BaseButton

  Specified by:
    `detachModel` in interface `com.sas.ViewInterface`
  Overrides:
    `detachModel` in class `ContainerVisualComponent`
  Parameters:
    `ModelInterface` - of the BaseButton
  See Also:
    `ViewInterface.detachModel(com.sas.ModelInterface)`

### refresh

    public void refresh(com.sas.ModelInterface model)

  Refresh the model attached to the BaseButton

  Specified by:
    `refresh` in interface `com.sas.ViewInterface`
  Overrides:
    `refresh` in class `ContainerVisualComponent`
  Parameters:
    `ModelInterface` - of the BaseButton.
  See Also:
    `ViewInterface.refresh(com.sas.ModelInterface)`

### refreshItem

    protected void refreshItem(java.lang.Object newItem)

  Refresh the contents displayed with the new Item value.

### removeActionListener

    public void removeActionListener(java.awt.event.ActionListener listener)

  Remove an ActionListener from the list of listeners to be notified of an ActionEvent.

  Specified by:
    `removeActionListener` in interface `ActionSource`
  Parameters:
    `listener` - an object which handles ActionEvent events
  See Also:
    `ActionListener`, `addActionListener(java.awt.event.ActionListener)`

### removeItemListener

    public void removeItemListener(java.awt.event.ItemListener listener)

  Remove an ItemListener from the list of listeners to be notified of an ItemEvent.

  Specified by:
    `removeItemListener` in interface `java.awt.ItemSelectable`
  See Also:
    `ItemListener`, `addItemListener(java.awt.event.ItemListener)`

### resizeToFit

    public void resizeToFit()

  Resize the button to fit the preferred size.

  See Also:
    `setResizeToFit(boolean)`, `isResizeToFit()`

### setActionCommand

    public void setActionCommand(java.lang.String cmd)

  Set the actionCommand to be sent out when an ActionEvent is triggered.

  Parameters:
    `cmd` - new Action Command
  See Also:
    `getActionCommand()`

### setBorderPainted

    public void setBorderPainted(boolean paint)

  Set whether the border is painted.

  Parameters:
    `paint` - If true, the border is painted, false border is not painted.
  See Also:
    `isBorderPainted()`

### setBounds

    public void setBounds(int x,
                          int y,
                          int width,
                          int height)

  Set the bounds of the BaseButton.

  Specified by:
    `setBounds` in interface `VisualInterface`
  Overrides:
    `setBounds` in class `ContainerVisualComponent`
  Parameters:
    `x` - the x position
    `y` - the y position
    `width` - the width of the button
    `height` - the height of the button
  See Also:
    `VisualInterface.setBounds(int, int, int, int)`

### setButtonListener

    public void setButtonListener(ButtonListenerInterface btnListener)

  Set the buttonListener for the BaseButton. The new listener is added as a MouseListener, MouseMotionListener, and as a KeyListener. The button model for the ButtonListenerInterface object is set to the model for this button. The buttonListener is meant to listen for user input and change the state of the buttonModel accordingly.

  Parameters:
    `btnListener` - the buttonListener
  See Also:
    `getButtonListener()`

### setButtonModel

    public void setButtonModel(ButtonModelInterface model)

  Set the buttonModel for the BaseButton. The ButtonModelInterface object contains the current state of the BaseButton. It also sends out the Action and Item events that are forwarded on to the BaseButton listeners of these events. The ButtonListenerInterface object's buttonModel is set to this buttonModel when the ButtonModel is set.

  Parameters:
    `model` - the buttonModel
  See Also:
    `getButtonModel()`

### setDefaultIcon

    public void setDefaultIcon(com.sas.visuals.IconInterface defaultImg)

  Set the default IconInterface object. This has to be set for any of the icon images to be shown.

  Parameters:
    `defaultImg` - the defaultImage
  See Also:
    `getDefaultIcon()`

### setDefaultValues

    public void setDefaultValues()

  Set the default internal values for the BaseButton.

  Specified by:
    `setDefaultValues` in interface `ContainerInterface`
  Specified by:
    `setDefaultValues` in interface `VisualInterface`
  Specified by:
    `setDefaultValues` in interface `com.sas.ComponentInterface`
  Overrides:
    `setDefaultValues` in class `CompositeContainer`
  See Also:
    `ContainerInterface.setDefaultValues()`

### setDisabledIcon

    public void setDisabledIcon(com.sas.visuals.IconInterface disabledImg)

  Set the IconInterface object to be painted when the button is disabled.

  Parameters:
    `disabledImg` - the disabledIcon
  See Also:
    `setDisabledIcon(com.sas.visuals.IconInterface)`

### setDisplayTransform

    public void setDisplayTransform(com.sas.util.transforms.TransformInterface transform)

  Set the Transform to be used to display the "item" property.

  Parameters:
    `transform` - the display transform
  See Also:
    `getDisplayTransform()`

### setEnabled

    public void setEnabled(boolean b)

  Set the button enabled state.

  Specified by:
    `setEnabled` in interface `VisualInterface`
  Overrides:
    `setEnabled` in class `ContainerVisualComponent`
  Parameters:
    `b` - If true the button is enabled, if false, the button is disabled.
  See Also:
    `VisualInterface.setEnabled(boolean)`

### setFocusGap

    public void setFocusGap(int g)

  Set the gap between the border and the focus rectangle.

  Parameters:
    `g` - - the pixel gap between the border and the focusRectangle.
  See Also:
    `getFocusGap()`

### setFocusPainted

    public void setFocusPainted(boolean paint)

  Set whether the focus rectangle should be painted.

  Parameters:
    `paint` - If true, the focus rectangle will be painted, if false, it will not.
  See Also:
    `isFocusPainted()`

### setFont

    public void setFont(java.awt.Font f)

  Set the font to be used to display the text of the BaseButton.

  Specified by:
    `setFont` in interface `VisualInterface`
  Overrides:
    `setFont` in class `ContainerVisualComponent`
  Parameters:
    `f` - the text font
  See Also:
    `VisualInterface.setFont(java.awt.Font)`

### setIconTextGap

    public void setIconTextGap(int g)

  Set the pixel gap between the IconInterface object and the text.

  Parameters:
    `g` - the pixels between where the icon and the text are painted.
  See Also:
    `getIconTextGap()`

### setHorizontalAlignment

    public void setHorizontalAlignment(int horizontalAlign)

  Set the horizontal alignment of the content of the BaseButton.

  Parameters:
    `horizontalAlign` - the horizontal alignment: LEFT(BEGIN), CENTER, or RIGHT(END)
  See Also:
    `getHorizontalAlignment()`

### setHorizontalTextAlignment

    public void setHorizontalTextAlignment(int hTextAlign)

  Set the horizontal alignment of the text of the BaseButton.

  Parameters:
    `hTextAlign` - the horizontal text alignment: LEFT(BEGIN), CENTER, or RIGHT(END)
  See Also:
    `getHorizontalTextAlignment()`

### setInsets

    public void setInsets(java.awt.Insets insets)

  Set the insets between the edge of the button and the content of the button.

  Specified by:
    `setInsets` in interface `ContainerInterface`
  Overrides:
    `setInsets` in class `ContainerContainerComponent`

### setItem

    public void setItem(java.lang.Object newItem)

  Set the item object that is transformed by the displayTransform for display as the content of the BaseButton.

  See Also:
    `SelectableInterface.setItem(java.lang.Object)`, `getItem()`

### setKeyAccelerator

    public void setKeyAccelerator(char key)

  Set the key to that when pressed triggers the BaseButton. Does nothing right now.

  Parameters:
    `key` - the character that triggers the BaseButton
  See Also:
    `getKeyAccelerator()`

### setPressedIcon

    public void setPressedIcon(com.sas.visuals.IconInterface pressedImg)

  Set the IconInterface object to be painted when the BaseButton state is pressed.

  Parameters:
    `pressedImg` - the pressedIcon
  See Also:
    `getPressedIcon()`

### setResizeToFit

    public void setResizeToFit(boolean resize)

  Set whether the BaseButton should be resized automatically to fit the contents when they are changed.

  Specified by:
    `setResizeToFit` in interface `ResizeToFitInterface`
  Parameters:
    `resize` - If true, the BaseButton is resized when the contents are changed, if false, the size is not changed when the contents change.
  See Also:
    `ResizeToFitInterface.setResizeToFit(boolean)`, `isResizeToFit()`

### setRolloverIcon

    public void setRolloverIcon(com.sas.visuals.IconInterface rolloverImg)

  Set the IconInterface object to be painted when the BaseButton state is rollover. The rollover state is when the mouse is over the top of the button but not being pressed.

  Parameters:
    `rolloverImg` - the rolloverIcon
  See Also:
    `getRolloverIcon()`

### setSelected

    public void setSelected(boolean selected)

  Set the button state to selected.

  Parameters:
    `selected` - the selected state of the button
  See Also:
    `isSelected()`

### setSelectedIcon

    public void setSelectedIcon(com.sas.visuals.IconInterface selectedImg)

  Set the IconInterface object to be painted when the BaseButton state is selected.

  Parameters:
    `selectedImg` - the selectedIcon
  See Also:
    `getSelectedIcon()`

### setText

    public void setText(java.lang.String txt)

  Set the text to be displayed on the BaseButton.

  Specified by:
    `setText` in interface `com.sas.lang.StringDataInterface`
  Parameters:
    `txt` - the text of the BaseButton
  See Also:
    `getText()`

### setTextPosition

    public void setTextPosition(int position)

  Set the position the text is displayed relative to the defaultIcon.

  Parameters:
    `position` - the textPosition: TOP, BOTTOM, LEFT, or RIGHT.
  See Also:
    `getTextPosition()`

### setVerticalAlignment

    public void setVerticalAlignment(int verticalAlign)

  Set the vertical alignment of the content displayed on the button.

  Parameters:
    `verticalAlign` - the vertical alignment: TOP, CENTER, or BOTTOM
  See Also:
    `getVerticalAlignment()`

### setVerticalTextAlignment

    public void setVerticalTextAlignment(int vTextAlign)

  Set the vertical alignment of the text displayed on the button.

  Parameters:
    `vTextAlign` - the vertical text alignment: TOP, CENTER, or BOTTOM
  See Also:
    `getVerticalTextAlignment()`

All Libraries | This Library | Package | Class | Use | Tree | Deprecated | Index | Grand Index | Help
|  | Components |
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 SAS Institute Inc. All Rights Reserved.