megamek.client.ui.AWT.widget
Class SizedButton

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Button
          extended by megamek.client.ui.AWT.widget.SizedButton
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
ImageButton

public class SizedButton
extends java.awt.Button

This class implements buttons that have a preferred size that is different than the smallest size needed to show its contents.

Author:
James Damour
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Button
java.awt.Button.AccessibleAWTButton
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SizedButton()
          Construct a button which can have its preferred size set.
SizedButton(java.awt.Dimension size)
          Construct a button with the given preferred size.
SizedButton(java.lang.String label)
          Construct a button with the given name that can have its preferred size set.
SizedButton(java.lang.String label, java.awt.Dimension size)
          Construct a button with the given label and preferred size.
 
Method Summary
 java.awt.Dimension getPreferredSize()
          Get the preferred size of this button.
 void setPreferredSize(java.awt.Dimension size)
          Set the preferred size of this button.
 void setPreferredSize(int width, int height)
          Set the preferred size of this button.
 
Methods inherited from class java.awt.Button
addActionListener, addNotify, getAccessibleContext, getActionCommand, getActionListeners, getLabel, getListeners, paramString, processActionEvent, processEvent, removeActionListener, setActionCommand, setLabel
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paint, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SizedButton

public SizedButton()
Construct a button which can have its preferred size set.


SizedButton

public SizedButton(java.lang.String label)
Construct a button with the given name that can have its preferred size set.

Parameters:
label - - the String label for the button.

SizedButton

public SizedButton(java.awt.Dimension size)
Construct a button with the given preferred size.

Parameters:
size - - the preferred Dimension for this button. The input parameter can be safely reused after this call.

SizedButton

public SizedButton(java.lang.String label,
                   java.awt.Dimension size)
Construct a button with the given label and preferred size.

Parameters:
label - - the String label for the button.
size - - the preferred Dimension for this button. The input parameter can be safely reused after this call.
Method Detail

getPreferredSize

public java.awt.Dimension getPreferredSize()
Get the preferred size of this button.

Overrides java.awt.Component#getPreferredSize().

Overrides:
getPreferredSize in class java.awt.Component
Returns:
the Dimension preferred by this button. This object can be safely reused after this call.

setPreferredSize

public void setPreferredSize(java.awt.Dimension size)
Set the preferred size of this button. If the requested value is less than the minimum size of the button in either dimension, the minimum in that dimension will be used instead.

Overrides:
setPreferredSize in class java.awt.Component
Parameters:
size - - the Dimension preferred by this button. This object can be safely reused after this call.

setPreferredSize

public void setPreferredSize(int width,
                             int height)
Set the preferred size of this button. If the requested value is less than the minimum size of the button in either dimension, the minimum in that dimension will be used instead.

Parameters:
width - - the int width preferred by this button.
height - - the int height preferred by this button.