public class JoinMenu extends Screen
Modifier and Type | Field and Description |
---|---|
private static double |
boxSize
Height of the details box.
|
private ClientConnection |
con
Server connection.
|
private java.awt.geom.Path2D |
connect
Connect button bounds.
|
private static double |
CONNECT_HEIGHT
Height of the connect button.
|
private boolean |
connecting
True is currently attempting to establish a connection.
|
private java.util.concurrent.ExecutorService |
executor
Executor used to connect to the remote server.
|
private static double |
fieldHeight
Height of the text fields.
|
private static double |
fieldWidth
Width of the text fields.
|
private TextField |
host
Host name input field.
|
private static java.lang.String |
lastHost
Last used host name.
|
private static java.lang.String |
lastName
Last used player name.
|
private static int |
MAX_WIDTH
Maximum width used by the boxes.
|
private java.lang.String |
msg
Current status message.
|
private TextField |
name
Player name input field.
|
private Player |
self
Local player.
|
BOTTOM_OFFSET, BOX_HEADER_HEIGHT, BOX_INSETS, BOX_SPACING, BOX_TEXT_OFFSET, SIDE_OFFSET, SPACING, TOP_MIDDLE_OFFSET, TOP_MIDDLE_TEXT_OFFSET, TOP_MIDDLE_WIDTH, TOP_OFFSET, TOP_SIDE_TRIANGLE, TOP_SPACE
Modifier | Constructor and Description |
---|---|
protected |
JoinMenu(ConvexMerger context)
Constructs a new join menu with the given game context.
|
Modifier and Type | Method and Description |
---|---|
private void |
connect()
Attempts to establish a connection to the server.
|
protected java.lang.String |
getLeftButtonText()
Gets the text for the bottom left button.
|
protected java.lang.String |
getRightButtonText()
Gets the text for the bottom right button.
|
void |
handleKeyPressed(java.awt.event.KeyEvent event)
Handles a key press event.
|
protected void |
handleLeftButtonClick()
Handles the bottom left button being clicked.
|
void |
handleMouseRelease(java.awt.geom.Point2D loc,
int width,
int height)
Handles a mouse button release on this screen.
|
protected void |
handleRightButtonClick()
Handles the bottom right button being clicked.
|
protected boolean |
isLeftButtonEnabled()
Checks if the bottom left button is enabled.
|
protected boolean |
isRightButtonEnabled()
Checks if the bottom right button is enabled.
|
protected void |
render(java.awt.Graphics2D g,
int width,
int height,
java.awt.geom.Point2D mouseLoc)
Renders the content of this screen with the given graphics.
|
computeBox, drawBox, drawButton, drawTitle, drawTitledBox, fillText, getContext, getMaxWidth, handleKeyReleased, handleMouseDrag, handleMouseMove, handleMousePress, render, renderMainInterface, renderMenuTitle, switchScene
private static final int MAX_WIDTH
private static final double CONNECT_HEIGHT
private static final double boxSize
private static final double fieldWidth
private static final double fieldHeight
private static java.lang.String lastHost
private static java.lang.String lastName
private java.util.concurrent.ExecutorService executor
private TextField name
private TextField host
private ClientConnection con
private Player self
private volatile boolean connecting
private volatile java.lang.String msg
private java.awt.geom.Path2D connect
protected JoinMenu(ConvexMerger context)
context
- The game context to use.protected void render(java.awt.Graphics2D g, int width, int height, java.awt.geom.Point2D mouseLoc)
Screen
private void connect()
public void handleKeyPressed(java.awt.event.KeyEvent event)
Screen
handleKeyPressed
in class Screen
event
- The key press event.public void handleMouseRelease(java.awt.geom.Point2D loc, int width, int height)
Screen
handleMouseRelease
in class Screen
loc
- The location that was clicked.width
- The width of the screen.height
- The height of the screen.protected boolean isLeftButtonEnabled()
Screen
isLeftButtonEnabled
in class Screen
protected boolean isRightButtonEnabled()
Screen
isRightButtonEnabled
in class Screen
protected java.lang.String getLeftButtonText()
Screen
getLeftButtonText
in class Screen
protected java.lang.String getRightButtonText()
Screen
getRightButtonText
in class Screen
protected void handleLeftButtonClick()
Screen
handleLeftButtonClick
in class Screen
protected void handleRightButtonClick()
Screen
handleRightButtonClick
in class Screen