|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
soc.client.SOCDiscardOrGainResDialog
class SOCDiscardOrGainResDialog
This is the dialog to ask players what resources they want to discard from rolling a 7, or to gain from the gold hex. Also used for the Discovery/Year of Plenty dev card.
For convenience with EventQueue.invokeLater(Runnable)
,
contains a run()
method which calls setVisible(true)
.
Before v2.0.00, this was called SOCDiscardDialog
,
and Year of Plenty used SOCDiscoveryDialog
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Dialog |
---|
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType |
Nested classes/interfaces inherited from class java.awt.Window |
---|
java.awt.Window.AccessibleAWTWindow |
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 | |
---|---|
private java.awt.Button |
clearBut
Clear button. |
(package private) boolean |
didSetLocation
Place window in center when displayed (in doLayout), don't change position afterwards |
private boolean |
isDiscard
Are we discarding, not gaining? |
(package private) ColorSquare[] |
keep
The 'keep' square resource types/counts only change if isDiscard . |
(package private) java.awt.Label |
msg
|
private int |
numChosen
Has chosen to discard or gain this many resources so far in pick . |
private int |
numPickNeeded
Must discard this many resources from keep , or must gain this many resources. |
private java.awt.Button |
okBut
Discard or Pick button |
private ColorSquare[] |
pick
Resource types/counts to discard or gain |
(package private) java.awt.Label |
pickThese
|
(package private) SOCPlayerInterface |
playerInterface
|
private static SOCStringManager |
strings
i18n text strings; will use same locale as SOCPlayerClient's string manager. |
protected int |
wantH
Desired size (visible size inside of insets) |
protected int |
wantW
Desired size (visible size inside of insets) |
(package private) java.awt.Label |
youHave
|
Fields inherited from class java.awt.Dialog |
---|
DEFAULT_MODALITY_TYPE |
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 | |
---|---|
SOCDiscardOrGainResDialog(SOCPlayerInterface pi,
int rnum,
boolean isDiscard)
Creates a new SOCDiscardOrGainResDialog popup. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
React to clicking Discard/Pick button or Clear button. |
void |
doLayout()
Custom layout, and setLocation call, for this dialog. |
void |
mouseClicked(java.awt.event.MouseEvent e)
Stub, required for MouseListener . |
void |
mouseEntered(java.awt.event.MouseEvent e)
Stub, required for MouseListener . |
void |
mouseExited(java.awt.event.MouseEvent e)
Stub, required for MouseListener . |
void |
mousePressed(java.awt.event.MouseEvent e)
When a resource's colorsquare is clicked, add/remove 1 from the resource totals as requested; update okBut
and clearBut . |
void |
mouseReleased(java.awt.event.MouseEvent e)
Stub, required for MouseListener . |
void |
run()
Run method, for convenience with EventQueue.invokeLater(Runnable) . |
void |
setVisible(boolean vis)
Show or hide this dialog. |
Methods inherited from class java.awt.Dialog |
---|
addNotify, getAccessibleContext, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, paramString, setModal, setModalityType, setResizable, setTitle, setUndecorated, show, toBack |
Methods inherited from class java.awt.Window |
---|
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, toFront |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, 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, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, 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, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, 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
private final boolean isDiscard
private java.awt.Button clearBut
pick
resource colorsquare counts to 0.
private java.awt.Button okBut
ColorSquare[] keep
isDiscard
.
private ColorSquare[] pick
java.awt.Label msg
java.awt.Label youHave
java.awt.Label pickThese
SOCPlayerInterface playerInterface
private final int numPickNeeded
keep
, or must gain this many resources.
private int numChosen
pick
.
okBut
is disabled unless proper number of resources (numPickNeeded
) are chosen.
protected int wantW
protected int wantH
boolean didSetLocation
Constructor Detail |
---|
public SOCDiscardOrGainResDialog(SOCPlayerInterface pi, int rnum, boolean isDiscard)
setVisible(true)
.
pi
- Client's player interfacernum
- Player must discard or gain this many resourcesisDiscard
- True for discard (after 7), false for gain (after gold hex)Method Detail |
---|
public void setVisible(boolean vis)
SOCPlayer.getResources()
,
and requests focus on the Discard/Pick button.
setVisible
in class java.awt.Dialog
vis
- True to make visible, false to hidepublic void doLayout()
doLayout
in class java.awt.Container
public void actionPerformed(java.awt.event.ActionEvent e)
ColorSquare clicks are handled in mousePressed(MouseEvent)
.
actionPerformed
in interface java.awt.event.ActionListener
e
- ActionEvent for the click, with EventObject.getSource()
== our buttonpublic void mouseEntered(java.awt.event.MouseEvent e)
MouseListener
.
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
MouseListener
.
mouseExited
in interface java.awt.event.MouseListener
public void mouseClicked(java.awt.event.MouseEvent e)
MouseListener
.
mouseClicked
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
MouseListener
.
mouseReleased
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
okBut
and clearBut
.
If not isDiscard, will not subtract change the "keep" colorsquare resource counts.
If we only need 1 total, and we've picked one and now pick a different one, zero the previous pick and change our choice to the new one.
Clear/Discard button clicks are handled in actionPerformed(ActionEvent)
.
mousePressed
in interface java.awt.event.MouseListener
public void run()
EventQueue.invokeLater(Runnable)
.
This method just calls setVisible(true)
.
run
in interface java.lang.Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |