|
|||||||||||
| 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.AskDialog
This is the generic dialog to ask players a two- or three-choice question.
To react to button presses, override the abstract methods
button1Chosen(), button2Chosen(),
windowCloseChosen(), and (for a three-choice
question) override button3Chosen().
| Nested Class Summary |
| Nested classes inherited from class java.awt.Dialog |
java.awt.Dialog.AccessibleAWTDialog |
| Nested classes inherited from class java.awt.Window |
java.awt.Window.AccessibleAWTWindow |
| Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
protected java.awt.Button |
choice1But
Button for first choice. |
protected java.awt.Button |
choice2But
Button for second choice. |
protected java.awt.Button |
choice3But
Optional button for third choice, or null. |
protected int |
choiceDefault
Default button (0 for none, or button 1, 2, or 3) |
protected boolean |
didReqFocus
Have we requested focus yet? |
protected java.awt.Label |
msg
Prompt message, or null |
protected int |
padH
Padding beyond desired size; not known until windowOpened() |
protected int |
padW
Padding beyond desired size; not known until windowOpened() |
protected SOCPlayerClient |
pcli
Player client; passed to constructor, not null |
protected SOCPlayerInterface |
pi
Player interface; passed to constructor; may be null if the question is related to the entire client, and not to a specific game |
protected int |
wantH
Desired size (visible size inside of insets) |
protected int |
wantW
Desired size (visible size inside of insets) |
| Fields inherited from class java.awt.Dialog |
|
| Fields inherited from class java.awt.Window |
|
| Fields inherited from class java.awt.Container |
|
| 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 | |
AskDialog(SOCPlayerClient cli,
java.awt.Frame parentFr,
java.lang.String titlebar,
java.lang.String prompt,
java.lang.String choice1,
java.lang.String choice2,
boolean default1,
boolean default2)
Creates a new AskDialog with two buttons, not about a specific game. |
|
AskDialog(SOCPlayerClient cli,
java.awt.Frame parentFr,
java.lang.String titlebar,
java.lang.String prompt,
java.lang.String choice1,
java.lang.String choice2,
java.lang.String choice3,
int defaultChoice)
Creates a new AskDialog with three buttons, not about a specific game. |
|
AskDialog(SOCPlayerClient cli,
SOCPlayerInterface gamePI,
java.lang.String titlebar,
java.lang.String prompt,
java.lang.String choice1,
java.lang.String choice2,
boolean default1,
boolean default2)
Creates a new AskDialog with two buttons, about a specific game. |
|
AskDialog(SOCPlayerClient cli,
SOCPlayerInterface gamePI,
java.lang.String titlebar,
java.lang.String prompt,
java.lang.String choice1,
java.lang.String choice2,
java.lang.String choice3,
int defaultChoice)
Creates a new AskDialog with three buttons, about a specific game. |
|
| Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
A button has been chosen by the user. |
abstract void |
button1Chosen()
Button 1 has been chosen by the user. |
abstract void |
button2Chosen()
Button 2 has been chosen by the user. |
void |
button3Chosen()
The optional button 3 has been chosen by the user. |
protected void |
checkSizeAndFocus()
Adjust size (vs insets) and set focus to the default button (if any). |
void |
keyPressed(java.awt.event.KeyEvent e)
Handle Enter or Esc key |
void |
keyReleased(java.awt.event.KeyEvent arg0)
Stub required by KeyListener |
void |
keyTyped(java.awt.event.KeyEvent arg0)
Stub required by KeyListener |
void |
mouseClicked(java.awt.event.MouseEvent e)
Stub required by MouseListener |
void |
mouseEntered(java.awt.event.MouseEvent e)
Check vs. |
void |
mouseExited(java.awt.event.MouseEvent e)
Stub required by MouseListener |
void |
mousePressed(java.awt.event.MouseEvent e)
Stub required by MouseListener |
void |
mouseReleased(java.awt.event.MouseEvent e)
Stub required by MouseListener |
static void |
styleAsDefault(java.awt.Button b)
Since we can't designate as default visually through the standard AWT API, try to bold the button text or set its color to white. |
void |
windowActivated(java.awt.event.WindowEvent e)
Stub required by WindowListener |
abstract void |
windowCloseChosen()
The dialog window was closed by the user, or ESC was pressed. |
void |
windowClosed(java.awt.event.WindowEvent e)
Stub required by WindowListener |
void |
windowClosing(java.awt.event.WindowEvent e)
Dialog close requested by user. |
void |
windowDeactivated(java.awt.event.WindowEvent e)
Stub required by WindowListener |
void |
windowDeiconified(java.awt.event.WindowEvent e)
Stub required by WindowListener |
void |
windowIconified(java.awt.event.WindowEvent e)
Stub required by WindowListener |
void |
windowOpened(java.awt.event.WindowEvent e)
Window is appearing - check the size and the default button keyboard focus |
| Methods inherited from class java.awt.Dialog |
addNotify, dispose, getAccessibleContext, getTitle, hide, isModal, isResizable, isUndecorated, paramString, setModal, setResizable, setTitle, setUndecorated, show |
| Methods inherited from class java.awt.Window |
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, toFront |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, 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, 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, isOpaque, 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, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected final SOCPlayerClient pcli
protected SOCPlayerInterface pi
protected final java.awt.Label msg
protected final java.awt.Button choice1But
button1Chosen()protected final java.awt.Button choice2But
button2Chosen()protected java.awt.Button choice3But
button3Chosen()protected final int choiceDefault
protected int wantW
protected int wantH
protected int padW
protected int padH
protected boolean didReqFocus
| Constructor Detail |
public AskDialog(SOCPlayerClient cli,
SOCPlayerInterface gamePI,
java.lang.String titlebar,
java.lang.String prompt,
java.lang.String choice1,
java.lang.String choice2,
boolean default1,
boolean default2)
throws java.lang.IllegalArgumentException
cli - Player client interfacegamePI - Current game's player interfacetitlebar - Title bar textprompt - Prompting text shown above buttons, or nullchoice1 - First choice button textchoice2 - Second choice button textdefault1 - First choice is defaultdefault2 - Second choice is default
java.lang.IllegalArgumentException - If both default1 and default2 are true,
or if any of these is null: cli, gamePI, prompt, choice1, choice2.
public AskDialog(SOCPlayerClient cli,
java.awt.Frame parentFr,
java.lang.String titlebar,
java.lang.String prompt,
java.lang.String choice1,
java.lang.String choice2,
boolean default1,
boolean default2)
throws java.lang.IllegalArgumentException
cli - Player client interfaceparentFr - SOCPlayerClient or other parent frametitlebar - Title bar textprompt - Prompting text shown above buttons, or nullchoice1 - First choice button textchoice2 - Second choice button textdefault1 - First choice is defaultdefault2 - Second choice is default
java.lang.IllegalArgumentException - If both default1 and default2 are true,
or if any of these is null: cli, gamePI, prompt, choice1, choice2.
public AskDialog(SOCPlayerClient cli,
SOCPlayerInterface gamePI,
java.lang.String titlebar,
java.lang.String prompt,
java.lang.String choice1,
java.lang.String choice2,
java.lang.String choice3,
int defaultChoice)
throws java.lang.IllegalArgumentException
cli - Player client interfacegamePI - Current game's player interfacetitlebar - Title bar textprompt - Prompting text shown above buttons, or nullchoice1 - First choice button textchoice2 - Second choice button textchoice3 - Third choice button text, or null if 2 buttonsdefaultChoice - Default button (1, 2, 3, or 0 for none)
java.lang.IllegalArgumentException - If defaultChoice out of range 0..3,
or if any of these is null: cli, gamePI, prompt, choice1, choice2,
or if choice3 is null and defaultChoice is 3.
public AskDialog(SOCPlayerClient cli,
java.awt.Frame parentFr,
java.lang.String titlebar,
java.lang.String prompt,
java.lang.String choice1,
java.lang.String choice2,
java.lang.String choice3,
int defaultChoice)
throws java.lang.IllegalArgumentException
cli - Player client interfaceparentFr - SOCPlayerClient or other parent frametitlebar - Title bar textprompt - Prompting text shown above buttons, or nullchoice1 - First choice button textchoice2 - Second choice button textchoice3 - Third choice button text, or null if 2 buttonsdefaultChoice - Default button (1, 2, 3, or 0 for none)
java.lang.IllegalArgumentException - If defaultChoice out of range 0..3,
or if any of these is null: cli, parentFr, prompt, choice1, choice2,
or if choice3 is null and defaultChoice is 3.| Method Detail |
protected void checkSizeAndFocus()
public static void styleAsDefault(java.awt.Button b)
b - Button to style visually as default. Please add button to
dialog layout before calling, so we can query the font.public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerpublic abstract void button1Chosen()
public abstract void button2Chosen()
public void button3Chosen()
public abstract void windowCloseChosen()
public void windowClosing(java.awt.event.WindowEvent e)
windowClosing in interface java.awt.event.WindowListenerpublic void windowOpened(java.awt.event.WindowEvent e)
windowOpened in interface java.awt.event.WindowListenerpublic void windowActivated(java.awt.event.WindowEvent e)
windowActivated in interface java.awt.event.WindowListenerpublic void windowClosed(java.awt.event.WindowEvent e)
windowClosed in interface java.awt.event.WindowListenerpublic void windowDeactivated(java.awt.event.WindowEvent e)
windowDeactivated in interface java.awt.event.WindowListenerpublic void windowDeiconified(java.awt.event.WindowEvent e)
windowDeiconified in interface java.awt.event.WindowListenerpublic void windowIconified(java.awt.event.WindowEvent e)
windowIconified in interface java.awt.event.WindowListenerpublic void keyPressed(java.awt.event.KeyEvent e)
keyPressed in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent arg0)
keyReleased in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent arg0)
keyTyped in interface java.awt.event.KeyListenerpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited in interface java.awt.event.MouseListenerpublic void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent e)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased in interface java.awt.event.MouseListener
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||