|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Panel soc.client.SOCBuildingPanel
public class SOCBuildingPanel
This class is a panel that shows how much it costs
to build things, and it allows the player to build.
Sits within a game's SOCPlayerInterface
frame.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Panel |
---|
java.awt.Panel.AccessibleAWTPanel |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
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 | |
---|---|
(package private) static java.lang.String |
CARD
|
(package private) java.awt.Button |
cardBut
|
(package private) java.awt.Label |
cardC
|
(package private) ColorSquare |
cardCount
|
(package private) java.awt.Label |
cardCountLab
|
(package private) ColorSquare |
cardOre
|
(package private) ColorSquare |
cardSheep
|
(package private) java.awt.Label |
cardT
|
(package private) ColorSquare |
cardWheat
|
(package private) static java.lang.String |
CITY
|
(package private) java.awt.Button |
cityBut
|
(package private) java.awt.Label |
cityC
|
(package private) ColorSquare |
cityOre
|
(package private) java.awt.Label |
cityT
|
(package private) ColorSquare |
cityWheat
|
private ColorSquare |
cloth
For game scenario _SC_CLVI , the
amount of cloth left in the board's "general supply". |
private java.awt.Label |
clothLab
|
(package private) java.awt.Button |
gameInfoBut
|
static int |
MINHEIGHT
Minimum required size of this panel, as laid out in doLayout() . |
private NewGameOptionsFrame |
ngof
"Game Info" window, from gameInfoBut click, or null. |
(package private) SOCPlayerInterface |
pi
Our parent window |
private int |
pieceButtonsState
Piece-purchase button status; either all "Buy", or when placing a piece, 1 type "Cancel" and the rest disabled. |
(package private) SOCPlayer |
player
Client's player data. |
(package private) static java.lang.String |
ROAD
|
(package private) java.awt.Button |
roadBut
|
(package private) java.awt.Label |
roadC
|
(package private) ColorSquare |
roadClay
|
(package private) java.awt.Label |
roadT
|
(package private) ColorSquare |
roadWood
|
private java.awt.Button |
sbBut
|
private boolean |
sbIsHilight
|
private java.awt.Label |
sbLab
"Special Building Phase" label. |
private static java.lang.String |
SBP
|
private java.awt.Panel |
sbPanel
For 6-player board: request Special Building Phase. |
(package private) java.awt.Button |
settlementBut
|
(package private) java.awt.Label |
settlementC
|
(package private) ColorSquare |
settlementClay
|
(package private) ColorSquare |
settlementSheep
|
(package private) java.awt.Label |
settlementT
|
(package private) ColorSquare |
settlementWheat
|
(package private) ColorSquare |
settlementWood
|
(package private) static java.lang.String |
SHIP
|
private java.awt.Button |
shipBut
For large sea board ( SOCGame.hasSeaBoard ), button to buy a ship. |
private java.awt.Label |
shipC
|
private ColorSquare |
shipSheep
|
private java.awt.Label |
shipT
|
private ColorSquare |
shipWood
|
(package private) java.awt.Button |
statsBut
|
(package private) javax.swing.JFrame |
statsFrame
|
(package private) static java.lang.String |
STLMT
|
private static SOCStringManager |
strings
i18n text strings |
(package private) java.awt.Label |
title
|
private ColorSquare |
vpToWin
|
private java.awt.Label |
vpToWinLab
|
private java.awt.Button |
wondersBut
For game scenario _SC_WOND , the
"Wonders" button that brings up a dialog with info and Build buttons. |
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 | |
---|---|
SOCBuildingPanel(SOCPlayerInterface pi)
make a new building panel |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Handle button clicks in this panel. |
void |
clickBuildingButton(SOCGame game,
java.lang.String target,
boolean doNotClearPopup)
Handle a click (Buy or Cancel) on a building-panel button. |
void |
doLayout()
custom layout for this panel. |
void |
gameWindowClosed()
React to our parent game window being closed. |
void |
setPlayer()
Set our game and player data based on client's nickname, via game.getPlayer(client.getNickname()). |
void |
updateButtonStatus()
Update the status of the buttons. |
void |
updateClothCount()
The board's general supply of cloth remaining has changed. |
void |
updateDevCardCount()
The game's count of development cards remaining has changed. |
void |
windowActivated(java.awt.event.WindowEvent e)
Required stub for WindowListener |
void |
windowClosed(java.awt.event.WindowEvent e)
If our "Game Info" window ( NewGameOptionsFrame ) is closed,
drop our reference to it so it can be gc'd. |
void |
windowClosing(java.awt.event.WindowEvent e)
Required stub for WindowListener |
void |
windowDeactivated(java.awt.event.WindowEvent e)
Required stub for WindowListener |
void |
windowDeiconified(java.awt.event.WindowEvent e)
Required stub for WindowListener |
void |
windowIconified(java.awt.event.WindowEvent e)
Required stub for WindowListener |
void |
windowOpened(java.awt.event.WindowEvent e)
Required stub for WindowListener |
Methods inherited from class java.awt.Panel |
---|
addNotify, getAccessibleContext |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final SOCStringManager strings
static final java.lang.String ROAD
static final java.lang.String STLMT
static final java.lang.String CITY
static final java.lang.String CARD
static final java.lang.String SHIP
private static final java.lang.String SBP
java.awt.Label title
java.awt.Button roadBut
java.awt.Button settlementBut
java.awt.Button cityBut
java.awt.Button cardBut
java.awt.Button gameInfoBut
java.awt.Button statsBut
javax.swing.JFrame statsFrame
java.awt.Label roadT
java.awt.Label roadC
ColorSquare roadWood
ColorSquare roadClay
java.awt.Label settlementT
java.awt.Label settlementC
ColorSquare settlementWood
ColorSquare settlementClay
ColorSquare settlementWheat
ColorSquare settlementSheep
java.awt.Label cityT
java.awt.Label cityC
ColorSquare cityWheat
ColorSquare cityOre
java.awt.Label cardT
java.awt.Label cardC
java.awt.Label cardCountLab
private java.awt.Label vpToWinLab
ColorSquare cardWheat
ColorSquare cardSheep
ColorSquare cardOre
ColorSquare cardCount
private ColorSquare vpToWin
private ColorSquare cloth
_SC_CLVI
, the
amount of cloth left in the board's "general supply". Null otherwise.
private java.awt.Label clothLab
private java.awt.Button wondersBut
_SC_WOND
, the
"Wonders" button that brings up a dialog with info and Build buttons. Null otherwise.
private java.awt.Label shipT
private java.awt.Label shipC
private ColorSquare shipWood
private ColorSquare shipSheep
private java.awt.Button shipBut
SOCGame.hasSeaBoard
), button to buy a ship.
Null if this game doesn't have that board.
private java.awt.Panel sbPanel
sbLab
and sbBut
centered on 1 line or 2 lines based on their text widths.
private java.awt.Button sbBut
private java.awt.Label sbLab
private boolean sbIsHilight
private int pieceButtonsState
Updated in updateButtonStatus()
.
Value is 0 for "Buy", or when placing a piece, a borrowed SOCGameState constant with the piece type:
PLACING_ROAD
, PLACING_SETTLEMENT
,
PLACING_CITY
, or PLACING_SHIP
.
When placing the second free road or ship, PLACING_FREE_ROAD2
.
Before v2.0.00 and i18n, button state was checked by comparing the button text to "Buy" or "Cancel".
private NewGameOptionsFrame ngof
gameInfoBut
click, or null.
Tracked to prevent showing more than 1 at a time.
SOCPlayerInterface pi
public static final int MINHEIGHT
doLayout()
.
SOCPlayer player
setPlayer()
Constructor Detail |
---|
public SOCBuildingPanel(SOCPlayerInterface pi)
pi
- the player interface that this panel is inMethod Detail |
---|
public void doLayout()
ColorSquare.HEIGHT
.
If you change the line spacing or total height laid out here,
please update MINHEIGHT
.
For 6-player games, sbPanel
is 2 "layout lines" tall here
on the standard board, 1 line tall on the large board,
and has its own custom doLayout()
based on whether its label
and button will fit on the same line or must be wrapped to 2 lines.
doLayout
in class java.awt.Container
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- button click eventpublic void gameWindowClosed()
GameStatisticsFrame
is showing, dispose it.
public void clickBuildingButton(SOCGame game, java.lang.String target, boolean doNotClearPopup)
SOCBoardPanel.BoardPopupMenu
also calls this method.
game
- The game, for statustarget
- Button clicked, as returned by ActionEvent.getActionCommanddoNotClearPopup
- Do not call SOCBoardPanel.popupClearBuildRequest()
public void updateButtonStatus()
public void updateDevCardCount()
public void updateClothCount()
SOCGameOption.K_SC_CLVI
.
public void setPlayer() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- If the player data has already been set,
and this isn't a new game (a board reset).public void windowClosed(java.awt.event.WindowEvent e)
NewGameOptionsFrame
) is closed,
drop our reference to it so it can be gc'd.
windowClosed
in interface java.awt.event.WindowListener
public void windowClosing(java.awt.event.WindowEvent e)
WindowListener
windowClosing
in interface java.awt.event.WindowListener
public void windowOpened(java.awt.event.WindowEvent e)
WindowListener
windowOpened
in interface java.awt.event.WindowListener
public void windowIconified(java.awt.event.WindowEvent e)
WindowListener
windowIconified
in interface java.awt.event.WindowListener
public void windowDeiconified(java.awt.event.WindowEvent e)
WindowListener
windowDeiconified
in interface java.awt.event.WindowListener
public void windowActivated(java.awt.event.WindowEvent e)
WindowListener
windowActivated
in interface java.awt.event.WindowListener
public void windowDeactivated(java.awt.event.WindowEvent e)
WindowListener
windowDeactivated
in interface java.awt.event.WindowListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |