|
||||||||||
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.SOCConnectOrPracticePanel
public class SOCConnectOrPracticePanel
This is the dialog for standalone client startup (JAR or otherwise) if no command-line arguments. Give choice of connect to server, start local server, or create practice game. Prompt for parameters for connect or start-server.
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 | |
---|---|
private boolean |
canLaunchServer
Do we have security to run a TCP server? Determined by calling checkCanLaunchServer() . |
private SOCPlayerClient.ClientNetwork |
clientNetwork
|
private java.awt.Button |
conn_cancel
|
private java.awt.Button |
conn_connect
|
private java.awt.TextField |
conn_pass
|
private java.awt.TextField |
conn_servhost
|
private java.awt.TextField |
conn_servport
|
private java.awt.TextField |
conn_user
|
private java.awt.Button |
connserv
"Connect to server" |
private SOCPlayerClient.GameAwtDisplay |
gd
|
private static java.awt.Color |
HEADER_LABEL_BG
|
private static java.awt.Color |
HEADER_LABEL_FG
|
private java.awt.Panel |
panel_conn
Contains GUI elements for details in connserv |
private java.awt.Panel |
panel_run
Contains GUI elements for details in runserv , or null if can't run. |
private java.awt.Button |
prac
"Practice" |
private java.awt.Button |
run_cancel
|
private java.awt.TextField |
run_servport
|
private java.awt.Button |
run_startserv
|
private java.awt.Button |
runserv
"Start a server" |
private static SOCStringManager |
strings
i18n text strings; will use same locale as SOCPlayerClient's string manager. |
private java.awt.Label |
topText
Welcome message, or error after disconnect |
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 | |
---|---|
SOCConnectOrPracticePanel(SOCPlayerClient.GameAwtDisplay gd)
Creates a new SOCConnectOrPracticePanel. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent ae)
React to button clicks |
static boolean |
checkCanLaunchServer()
Check with the SecurityManager about being a tcp server. |
void |
clickConnCancel()
Hide fields used to connect to server. |
private void |
clickConnConnect()
"Connect..." from connect setup; check fields, set WAIT_CURSOR, ask cli to connect |
private void |
clickRunCancel()
Hide fields used to start a server |
private void |
clickRunStartserv()
Actually start a server, on port from run_servport |
private java.awt.Panel |
initInterface_conn()
panel_conn setup |
private java.awt.Panel |
initInterface_run()
panel_run setup |
private void |
initInterfaceElements()
Interface setup for constructor. |
void |
keyPressed(java.awt.event.KeyEvent e)
Handle Enter or Esc key (KeyListener) |
void |
keyReleased(java.awt.event.KeyEvent arg0)
Stub required by KeyListener |
void |
keyTyped(java.awt.event.KeyEvent arg0)
Stub required by KeyListener |
private int |
parsePortNumberOrDefault(java.awt.TextField tf)
Parse a server TCP port number from a text field. |
void |
setTopText(java.lang.String newText)
Set the line of text displayed at the top of the panel. |
void |
startedLocalServer()
A local server has been started; disable other options ("Connect", etc) but not Practice. |
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, doLayout, 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 final SOCPlayerClient.GameAwtDisplay gd
private final SOCPlayerClient.ClientNetwork clientNetwork
private java.awt.Label topText
private java.awt.Button prac
private java.awt.Button connserv
private java.awt.Panel panel_conn
connserv
private java.awt.TextField conn_servhost
private java.awt.TextField conn_servport
private java.awt.TextField conn_user
private java.awt.TextField conn_pass
private java.awt.Button conn_connect
private java.awt.Button conn_cancel
private java.awt.Button runserv
private java.awt.Panel panel_run
runserv
, or null if can't run.
private java.awt.TextField run_servport
private java.awt.Button run_startserv
private java.awt.Button run_cancel
private final boolean canLaunchServer
checkCanLaunchServer()
.
private static final java.awt.Color HEADER_LABEL_BG
private static final java.awt.Color HEADER_LABEL_FG
private static final SOCStringManager strings
Constructor Detail |
---|
public SOCConnectOrPracticePanel(SOCPlayerClient.GameAwtDisplay gd)
gd
- Player client displayMethod Detail |
---|
public static boolean checkCanLaunchServer()
SecurityManager
about being a tcp server.
Port SOCPlayerClient.ClientNetwork.SOC_PORT_DEFAULT
and some subsequent ports are checked (to be above 1024).
private void initInterfaceElements()
private java.awt.Panel initInterface_conn()
private java.awt.Panel initInterface_run()
public void startedLocalServer()
SOCPlayerClient.GameAwtDisplay.startLocalTCPServer(int)
.
public void setTopText(java.lang.String newText)
newText
- New text to displayprivate final int parsePortNumberOrDefault(java.awt.TextField tf)
clientNetwork.getPort()
,
which is usually SOCPlayerClient.ClientNetwork.SOC_PORT_DEFAULT
.
tf
- Text field with the port number, such as conn_servport
or run_servport
clientNetwork.getPort()
if empty,
or 0 if cannot be parsed or if outside the valid range 1-65535public void actionPerformed(java.awt.event.ActionEvent ae)
actionPerformed
in interface java.awt.event.ActionListener
private void clickConnConnect()
public void clickConnCancel()
private void clickRunStartserv()
run_servport
private void clickRunCancel()
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent arg0)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent arg0)
keyTyped
in interface java.awt.event.KeyListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |