Blackjack

com.amoebacode.blackjack.display.button
Class ButtonBase

java.lang.Object
  |
  +--com.amoebacode.blackjack.display.DisplayElement
        |
        +--com.amoebacode.blackjack.display.button.ButtonBase
Direct Known Subclasses:
GameButton, HandButton

abstract class ButtonBase
extends DisplayElement

ButtonBase is the base class for all user buttons.

Version:
0.9
Author:
Jason Gurney

Field Summary
private  javax.swing.JButton button
          The button component managed by this object
protected  java.awt.event.ActionListener buttonListener
          The listener for this button
private static int HEIGHT
          The height in pixels of this button
private static int WIDTH
          The width in pixels of this button
 
Fields inherited from class com.amoebacode.blackjack.display.DisplayElement
parent
 
Constructor Summary
protected ButtonBase(DisplayElement parent)
          Default protected constructor.
 
Method Summary
protected abstract  void actionPreamble(java.awt.event.ActionEvent ae)
          Performs the preamble to the specified action event.
protected  void activate()
          Displays and enables this button.
protected  void clear()
          Removes this button from the primary layered pane.
protected  void disable()
          Disables this button.
protected  void displayDisable()
          Displays but disables this button.
protected  java.awt.event.ActionListener getButtonListener()
          Returns the listener for this button (used to control the button's action).
protected abstract  java.lang.String getButtonText()
          Returns the button text.
protected  int getHeight()
          Returns the height of the button.
protected abstract  java.lang.String getToolTipText()
          Returns the help text that appears when the user mouses over the button.
protected  int getWidth()
          Returns the width of the button.
protected abstract  int getXPos()
          Returns the horizontal position of the button.
protected abstract  int getYPos()
          Returns the vertical position of the button.
protected  void hide()
          Hides and disables this button.
protected  void setMouseEnteredBackground()
          Sets the mouse enter background color.
protected  void setMouseExitedBackground()
          Sets the mouse exit background color.
protected  void setupButton()
          Creates the button component and adds it to the violator layer of the primary layered pane.
 
Methods inherited from class com.amoebacode.blackjack.display.DisplayElement
executeGameCommand, getDisplayManager, getGameDisplay, getParent, hasParent, playGameClip, queueAction, resumeQueue
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

button

private javax.swing.JButton button
The button component managed by this object

buttonListener

protected java.awt.event.ActionListener buttonListener
The listener for this button

WIDTH

private static final int WIDTH
The width in pixels of this button

HEIGHT

private static final int HEIGHT
The height in pixels of this button
Constructor Detail

ButtonBase

protected ButtonBase(DisplayElement parent)
Default protected constructor.
Parameters:
parent - the parent DisplayElement for this button
Method Detail

getButtonText

protected abstract java.lang.String getButtonText()
Returns the button text.
Returns:
the button text

getXPos

protected abstract int getXPos()
Returns the horizontal position of the button.
Returns:
the horizontal position in pixels

getYPos

protected abstract int getYPos()
Returns the vertical position of the button.
Returns:
the vertical position in pixels

getToolTipText

protected abstract java.lang.String getToolTipText()
Returns the help text that appears when the user mouses over the button.
Returns:
the mouseover help text

actionPreamble

protected abstract void actionPreamble(java.awt.event.ActionEvent ae)
Performs the preamble to the specified action event.
Parameters:
ae - the ActionEvent being fired

setupButton

protected void setupButton()
Creates the button component and adds it to the violator layer of the primary layered pane.

setMouseEnteredBackground

protected void setMouseEnteredBackground()
Sets the mouse enter background color.

setMouseExitedBackground

protected void setMouseExitedBackground()
Sets the mouse exit background color.

getButtonListener

protected java.awt.event.ActionListener getButtonListener()
Returns the listener for this button (used to control the button's action).
Returns:
the ActionListener for this button

activate

protected void activate()
Displays and enables this button.

displayDisable

protected void displayDisable()
Displays but disables this button.

disable

protected void disable()
Disables this button.

hide

protected void hide()
Hides and disables this button.

getWidth

protected int getWidth()
Returns the width of the button.
Returns:
the width in pixels

getHeight

protected int getHeight()
Returns the height of the button.
Returns:
the height in pixels

clear

protected void clear()
Removes this button from the primary layered pane.

Blackjack

Copyright © 2002 amoebacode.com.