Blackjack

com.amoebacode.blackjack.display.combobox
Class ComboBoxBase

java.lang.Object
  |
  +--com.amoebacode.blackjack.display.DisplayElement
        |
        +--com.amoebacode.blackjack.display.combobox.ComboBoxBase
Direct Known Subclasses:
HouseRulesComboBox, PreferencesComboBox

abstract class ComboBoxBase
extends DisplayElement

ComboBoxBase is the base class for all user combo boxes.

Version:
0.9
Author:
Jason Gurney

Field Summary
private  javax.swing.JComboBox comboBox
          The select box component managed by this object
private static int HEIGHT
          The height in pixels of this select box
private static int WIDTH
          The width in pixels of this select box
 
Fields inherited from class com.amoebacode.blackjack.display.DisplayElement
parent
 
Constructor Summary
protected ComboBoxBase(DisplayElement parent)
          Default protected constructor.
 
Method Summary
protected  void clear()
          Removes this select box from the primary layered pane.
protected  int getHeight()
          Returns the height of the select box.
protected abstract  java.lang.String[] getOptions()
          Returns the options for this select box.
protected abstract  int getSelectedIndex()
          Returns the index of the currently selected option (used when the select box is being created).
protected abstract  java.lang.String getToolTipText()
          Returns the help text that appears when the user mouses over the select box.
protected  int getWidth()
          Returns the width of the select box.
protected abstract  int getXPos()
          Returns the horizontal position of the select box.
protected abstract  int getYPos()
          Returns the vertical position of the select box.
protected  void performAction()
          Performs the action corresponding to the selected combo box item.
protected abstract  void performAction(java.lang.String selectedItem)
          Performs the action associated with the specified selection (called when the user updates the select box).
protected  void setupComboBox()
          Creates the select box component and adds it to the violator layer of the primary layered pane.
 void setVisible(boolean visible)
          Sets the visibility attribute of this select box.
 
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

comboBox

private javax.swing.JComboBox comboBox
The select box component managed by this object

WIDTH

private static final int WIDTH
The width in pixels of this select box

HEIGHT

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

ComboBoxBase

protected ComboBoxBase(DisplayElement parent)
Default protected constructor.
Parameters:
parent - the parent DisplayElement
Method Detail

getOptions

protected abstract java.lang.String[] getOptions()
Returns the options for this select box.
Returns:
a String array of options for this select box

performAction

protected abstract void performAction(java.lang.String selectedItem)
Performs the action associated with the specified selection (called when the user updates the select box).
Parameters:
selectedItem - the option selected by the user

getXPos

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

getYPos

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

getSelectedIndex

protected abstract int getSelectedIndex()
Returns the index of the currently selected option (used when the select box is being created).
Returns:
the index of the currently selected option

getToolTipText

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

setupComboBox

protected void setupComboBox()
Creates the select box component and adds it to the violator layer of the primary layered pane.

performAction

protected void performAction()
Performs the action corresponding to the selected combo box item.

setVisible

public void setVisible(boolean visible)
Sets the visibility attribute of this select box.
Parameters:
visible - the new visibility value

getWidth

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

getHeight

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

clear

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

Blackjack

Copyright © 2002 amoebacode.com.