com.asdf.plugins.pokergames.gameview
Class GameViewButtonPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.asdf.plugins.pokergames.gameview.GameViewButtonPanel
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class GameViewButtonPanel
extends javax.swing.JPanel
implements java.awt.event.ActionListener

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 PokerGameTypes gametype
           
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
GameViewButtonPanel(PokerGameTypes game, javax.swing.JLayeredPane table)
          Creates button panel of given gametype (poker only atm)
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Actionhandler that makes sure that only one or none is selected from waitgrid.
 void sendActionLeaveToController(boolean closetable)
          Sends leaveaction to controller.
 void sendActionToController(int action)
          Sends action to controller.
 void sendRaiseToController(double amount)
          Sends raiseaction to controller with given amount of money.
 void sendSitOutToController(GameViewCheckBoxPanel gcbp)
          Sends sitout action to controller and clears autositout checkbox for comeback
 void setAllHidden()
          hides all components from button panel.
 void setBetAndPot(double bet_, double pot_)
          Sets values to bot and bet
 void setBetMenuSize(int x, int y)
          Moves betmenu (if any) to southeast corner of given cordinates.
 void setController(PokerGameController pgc)
          Sets controller to this buttonpanel and clears GUI.
 void setDiscardButton()
          Sets discard button panel.
 void setMuckButtons()
          Sets muck buttons.
 void setPokerButtons(double amounttocall, double pot, double bank, double amountraisable, double minraise)
          Sets actionbuttons CHECK, FOLD, CALL, RAISE and activates betmenu.
 void setPostBlindButtons()
          Sets post blind buttons.
 void setSitOutButton()
          Sets sitout button panel.
 void setWaitGrid(double amttocall, double amtraisable, double minraise, double bank)
          Sets predefined-action grid for current gamesituation.
 void updateWaitGrid(double minraise, double amttocall, double bank)
          Unvalidate options from grid that are no longer valid because of changed gamesituation.
 void updateX()
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

gametype

public PokerGameTypes gametype
Constructor Detail

GameViewButtonPanel

public GameViewButtonPanel(PokerGameTypes game,
                           javax.swing.JLayeredPane table)
Creates button panel of given gametype (poker only atm)

Parameters:
game - GameType
table - JLayeredpane to attach possible betmenu.
Method Detail

updateX

public void updateX()

setBetMenuSize

public void setBetMenuSize(int x,
                           int y)
Moves betmenu (if any) to southeast corner of given cordinates.


setController

public void setController(PokerGameController pgc)
Sets controller to this buttonpanel and clears GUI.


sendSitOutToController

public void sendSitOutToController(GameViewCheckBoxPanel gcbp)
Sends sitout action to controller and clears autositout checkbox for comeback

Parameters:
gcbp - Panel where autositout checkbox is located.

sendRaiseToController

public void sendRaiseToController(double amount)
Sends raiseaction to controller with given amount of money.

Parameters:
amount - Amount of money raised.

sendActionLeaveToController

public void sendActionLeaveToController(boolean closetable)
Sends leaveaction to controller.

Parameters:
closetable - Do we close remove controller too.

sendActionToController

public void sendActionToController(int action)
Sends action to controller.

Parameters:
action - Action that we want to send.

setAllHidden

public void setAllHidden()
hides all components from button panel. except pot+bet.


setBetAndPot

public void setBetAndPot(double bet_,
                         double pot_)
Sets values to bot and bet

Parameters:
bet_ - Current bet value.
pot_ - Current pot value.

setDiscardButton

public void setDiscardButton()
Sets discard button panel. Contains button "DISCARD".


setSitOutButton

public void setSitOutButton()
Sets sitout button panel. Contains button "Im back".


setPostBlindButtons

public void setPostBlindButtons()
Sets post blind buttons. Contains buttons "post" and "wait".


setMuckButtons

public void setMuckButtons()
Sets muck buttons. Contains buttons "muck cards" and "show cards".


setPokerButtons

public void setPokerButtons(double amounttocall,
                            double pot,
                            double bank,
                            double amountraisable,
                            double minraise)
Sets actionbuttons CHECK, FOLD, CALL, RAISE and activates betmenu. activated buttons and menu are calculated from gamesituation and only buttons that are valid are shown

Parameters:
amounttocall - How much player has to pay to call.
pot - Pot size.
bank - Players bankroll.
amountraisable - Howmuch is it possible for this player to raise.
minraise - Minimum raise.

updateWaitGrid

public void updateWaitGrid(double minraise,
                           double amttocall,
                           double bank)
Unvalidate options from grid that are no longer valid because of changed gamesituation.

Parameters:
minraise - Minimumraise.
amttocall - Amount to call.
bank - Players Bankroll.

setWaitGrid

public void setWaitGrid(double amttocall,
                        double amtraisable,
                        double minraise,
                        double bank)
Sets predefined-action grid for current gamesituation.

Parameters:
amttocall -
amtraisable -
minraise -
bank -

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Actionhandler that makes sure that only one or none is selected from waitgrid. needed because radiobutton/boxgroup cannot de-select once you have selected once.

Specified by:
actionPerformed in interface java.awt.event.ActionListener