|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLayeredPane
javax.swing.JDesktopPane
net.sf.freecol.client.gui.Canvas
public final class Canvas
The main container for the other GUI components in FreeCol. This container is
where the panels, dialogs and menus are added. In addition, this is the
component in which the map graphics are displayed.
Displaying panels and a dialogs
Canvas
contains methods to display various panels and dialogs.
Most of these methods use i18n
to get
localized text. Here is an example:
if (canvas.showConfirmDialog("choice.text", "choice.yes", "choice.no")) { // DO SOMETHING. }
i18n
for more
information. showXXXDialog
, the calling
thread will wait until that dialog is dismissed before returning. In
contrast, a showXXXPanel
-method returns immediately.
Nested Class Summary | |
---|---|
static class |
Canvas.BoycottAction
|
static class |
Canvas.MissionaryAction
|
static class |
Canvas.ScoutAction
|
static class |
Canvas.TradeAction
|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.BaselineResizeBehavior |
Field Summary |
---|
Fields inherited from class javax.swing.JDesktopPane |
---|
LIVE_DRAG_MODE, OUTLINE_DRAG_MODE |
Fields inherited from class javax.swing.JLayeredPane |
---|
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER |
Fields inherited from class javax.swing.JComponent |
---|
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
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 | |
---|---|
Canvas(FreeColClient client,
java.awt.Dimension size,
GUI gui)
The constructor to use. |
Method Summary | ||
---|---|---|
java.awt.Component |
add(java.awt.Component comp)
Adds a component to this Canvas. |
|
void |
add(java.awt.Component comp,
java.lang.Integer i)
Adds a component to this Canvas. |
|
void |
add(java.awt.Component comp,
java.lang.Integer i,
boolean update)
Adds a component to this Canvas. |
|
javax.swing.JInternalFrame |
addAsFrame(javax.swing.JComponent comp)
Adds a component centered on this Canvas inside a frame. |
|
javax.swing.JInternalFrame |
addAsSimpleFrame(javax.swing.JComponent comp)
Adds a component centered on this Canvas inside a frame. |
|
javax.swing.JInternalFrame |
addAsToolBox(javax.swing.JComponent comp)
Adds a component centered on this Canvas inside a frame. |
|
java.awt.Component |
addCentered(java.awt.Component comp)
Adds a component centered on this Canvas. |
|
void |
addCentered(java.awt.Component comp,
java.lang.Integer i)
Adds a component centered on this Canvas. |
|
void |
closeMainPanel()
Closes the MainPanel . |
|
void |
closeMenus()
Closes all the menus that are currently open. |
|
void |
closeStatusPanel()
Closes the StatusPanel . |
|
boolean |
containsInGameComponents()
Checks if this Canvas contains any ingame components. |
|
void |
deactivateMovable(javax.swing.JComponent c)
Removes the mouse listeners for moving the frame of the given component. |
|
void |
displayChatMessage(Player sender,
java.lang.String message,
boolean privateChat)
Tells the map controls that a chat message was received. |
|
void |
displayChatMessage(java.lang.String message)
Displays a chat message originating from this client. |
|
void |
errorMessage(java.lang.String messageID)
Displays an error message. |
|
void |
errorMessage(java.lang.String messageID,
java.lang.String message)
Displays an error message. |
|
FreeColClient |
getClient()
Returns the freeColClient. |
|
ClientOptionsDialog |
getClientOptionsDialog()
Returns the ClientOptionsDialog . |
|
GUI |
getColonyTileGUI()
|
|
EuropePanel |
getEuropePanel()
Gets the EuropePanel . |
|
GUI |
getGUI()
Returns this Canvas 's GUI . |
|
javax.swing.ImageIcon |
getImageIcon(java.lang.Object display,
boolean small)
Returns the appropriate ImageIcon for Object. |
|
ImageLibrary |
getImageLibrary()
|
|
LoadingSavegameDialog |
getLoadingSavegameDialog()
Gets the LoadingSavegameDialog . |
|
MainPanel |
getMainPanel()
Gets the MainPanel . |
|
MapControls |
getMapControls()
Returns the MapControls of this Canvas. |
|
java.awt.Dimension |
getMinimumSize()
|
|
java.awt.Dimension |
getPreferredSize()
|
|
StartGamePanel |
getStartGamePanel()
Gets the StartGamePanel that lies in this container. |
|
boolean |
isClientOptionsDialogShowing()
Checks if the ClientOptionsDialog is visible. |
|
boolean |
isMapboardActionsEnabled()
Checks if mapboard actions should be enabled. |
|
boolean |
isShowingSubPanel()
Checks if this Canvas displaying another panel. |
|
void |
newGame()
Displays a quit dialog and, if desired, logs out of the current game and shows the new game panel. |
|
void |
paintComponent(java.awt.Graphics g)
Paints this component. |
|
void |
quit()
Quits the application. |
|
void |
refresh()
Refreshes this Canvas visually. |
|
void |
refreshTile(int x,
int y)
Refreshes the screen at the specified Tile. |
|
void |
refreshTile(Map.Position p)
Refreshes the screen at the specified Tile. |
|
void |
refreshTile(Tile t)
Refreshes the screen at the specified Tile. |
|
void |
remove(java.awt.Component comp)
Removes the given component from this Container. |
|
void |
remove(java.awt.Component comp,
boolean update)
Removes the given component from this Container. |
|
void |
removeInGameComponents()
Removes components that is only used when in game. |
|
void |
retire()
Quits the application. |
|
void |
returnToTitle()
Closes all panels, changes the background and shows the main menu. |
|
Canvas.ScoutAction |
showArmedUnitIndianSettlementDialog(IndianSettlement settlement)
Displays a dialog that asks the user what he wants to do with his armed unit in the indian settlement. |
|
Canvas.BoycottAction |
showBoycottedGoodsDialog(Goods goods,
Europe europe)
Displays a dialog that asks the user whether to pay arrears for boycotted goods or to dump them instead. |
|
void |
showChatPanel()
Displays the ChatPanel . |
|
|
showChoiceDialog(java.lang.String text,
java.lang.String cancelText,
java.util.List<ChoiceItem<T>> choices)
Displays a dialog with a text and a cancel-button, in addition to buttons for each of the objects returned for the given Iterator . |
|
boolean |
showClientOptionsDialog()
Displays a dialog for setting client options. |
|
void |
showColonyPanel(Colony colony)
Displays the colony panel of the given Colony . |
|
boolean |
showConfirmDialog(ModelMessage[] messages,
java.lang.String okText,
java.lang.String cancelText)
Displays a dialog with a text and a ok/cancel option. |
|
boolean |
showConfirmDialog(java.lang.String text,
java.lang.String okText,
java.lang.String cancelText,
java.lang.String... replace)
Displays a dialog with a text and a ok/cancel option. |
|
int |
showEmigrationPanel(boolean fountainOfYouth)
Shows the panel that allows the user to choose which unit will emigrate from Europe. |
|
int |
showEuropeDialog(EuropePanel.EuropeAction europeAction)
Displays one of the Europe Dialogs for Recruit, Purchase, Train. |
|
void |
showEuropePanel()
Displays the EuropePanel . |
|
|
showFreeColDialog(FreeColDialog<T> freeColDialog)
Displays the given dialog. |
|
boolean |
showInciteDialog(Player enemy,
int amount)
Displays a yes/no question to the user asking if he wants to pay the given amount to an indian tribe in order to have them declare war on the given player. |
|
Canvas.TradeAction |
showIndianSettlementTradeDialog(Settlement settlement,
boolean showBuy,
boolean showSell,
boolean showGift)
Displays the panel for trading with an IndianSettlement . |
|
void |
showInformationMessage(java.lang.String messageId)
Shows a message with some information and an "OK"-button. |
|
void |
showInformationMessage(java.lang.String messageId,
FreeColObject displayObject)
Shows a message with some information and an "OK"-button. |
|
void |
showInformationMessage(java.lang.String messageId,
FreeColObject displayObject,
java.lang.String... replace)
Shows a message with some information and an "OK"-button. |
|
void |
showInformationMessage(java.lang.String messageId,
java.lang.String... replace)
Shows a message with some information and an "OK"-button. |
|
java.lang.String |
showInputDialog(java.lang.String text,
java.lang.String defaultValue,
java.lang.String okText,
java.lang.String cancelText,
boolean rejectEmptyString,
java.lang.String... data)
Displays a dialog with a text field and a ok/cancel option. |
|
java.lang.String |
showInputDialog(java.lang.String text,
java.lang.String defaultValue,
java.lang.String okText,
java.lang.String cancelText,
java.lang.String... data)
Displays a dialog with a text field and a ok/cancel option. |
|
java.io.File |
showLoadDialog(java.io.File directory)
Displays a dialog where the user may choose a file. |
|
java.io.File |
showLoadDialog(java.io.File directory,
javax.swing.filechooser.FileFilter[] fileFilters)
Displays a dialog where the user may choose a file. |
|
boolean |
showLoadingSavegameDialog(boolean publicServer,
boolean singleplayer)
Displays a dialog for setting options when loading a savegame. |
|
void |
showMainPanel()
Shows the MainPanel . |
|
boolean |
showMapGeneratorOptionsDialog(boolean editable)
Displays a dialog for setting the map generator options. |
|
boolean |
showMapGeneratorOptionsDialog(boolean editable,
MapGeneratorOptions mgo)
Displays a dialog for setting the map generator options. |
|
void |
showModelMessages(ModelMessage... modelMessages)
Displays a number of ModelMessages. |
|
DiplomaticTrade |
showNegotiationDialog(Unit unit,
Settlement settlement,
DiplomaticTrade agreement)
Displays the NegotiationDialog . |
|
void |
showOpenGamePanel()
Shows the OpenGamePanel . |
|
void |
showOpeningVideoPanel()
Shows the VideoPanel . |
|
void |
showPanel(FreeColPanel panel)
Displays a FreeColPanel . |
|
void |
showPanel(FreeColPanel panel,
boolean centered)
Displays a FreeColPanel . |
|
void |
showPopup(javax.swing.JPopupMenu popup,
int x,
int y)
Shows the given popup at the given position on the screen. |
|
java.io.File |
showSaveDialog(java.io.File directory,
java.lang.String defaultName)
Displays a dialog where the user may choose a filename. |
|
java.io.File |
showSaveDialog(java.io.File directory,
java.lang.String standardName,
javax.swing.filechooser.FileFilter[] fileFilters,
java.lang.String defaultName)
Displays a dialog where the user may choose a filename. |
|
Canvas.ScoutAction |
showScoutForeignColonyDialog(Colony colony,
Unit unit)
Displays a dialog that asks the user what he wants to do with his scout in the foreign colony. |
|
Canvas.ScoutAction |
showScoutIndianSettlementDialog(IndianSettlement settlement)
Displays a dialog that asks the user what he wants to do with his scout in the indian settlement. |
|
void |
showServerListPanel(java.lang.String username,
java.util.ArrayList<ServerInfo> serverList)
Displays the ServerListPanel . |
|
|
showSimpleChoiceDialog(java.lang.String text,
java.lang.String cancelText,
java.util.List<T> objects)
Displays a dialog with a text and a cancel-button, in addition to buttons for each of the objects in the array. |
|
void |
showStartGamePanel(Game game,
Player player,
boolean singlePlayerMode)
Displays the StartGamePanel . |
|
void |
showStatusPanel(java.lang.String message)
Shows a status message that cannot be dismissed. |
|
void |
showSubPanel(FreeColPanel panel)
Displays a FreeColPanel . |
|
void |
showTilePopup(Map.Position pos,
int x,
int y)
Shows a tile popup. |
|
java.util.List<java.lang.Object> |
showUseMissionaryDialog(IndianSettlement settlement)
Displays a dialog that asks the user what he wants to do with his missionary in the indian settlement. |
|
void |
updateGoldLabel()
Updates the label displaying the current amount of gold. |
|
void |
updateSizes()
Updates the sizes of the components on this Canvas. |
Methods inherited from class javax.swing.JDesktopPane |
---|
getAccessibleContext, getAllFrames, getAllFramesInLayer, getDesktopManager, getDragMode, getSelectedFrame, getUI, getUIClassID, remove, removeAll, selectFrame, setComponentZOrder, setDesktopManager, setDragMode, setSelectedFrame, setUI, updateUI |
Methods inherited from class javax.swing.JLayeredPane |
---|
getComponentCountInLayer, getComponentsInLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getPosition, highestLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, putLayer, setLayer, setLayer, setPosition |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, removeContainerListener, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Canvas(FreeColClient client, java.awt.Dimension size, GUI gui)
client
- main control class.size
- The bounds of this Canvas
.gui
- The object responsible of drawing the map onto this component.Method Detail |
---|
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public GUI getColonyTileGUI()
public ClientOptionsDialog getClientOptionsDialog()
ClientOptionsDialog
.
ClientOptionsDialog
ClientOptions
public ImageLibrary getImageLibrary()
public void updateGoldLabel()
public void updateSizes()
public void paintComponent(java.awt.Graphics g)
GUI.display(java.awt.Graphics2D)
to draw
the map/background on this component.
paintComponent
in class javax.swing.JComponent
g
- The Graphics context in which to draw this component.GUI.display(java.awt.Graphics2D)
public void showStartGamePanel(Game game, Player player, boolean singlePlayerMode)
StartGamePanel
.
game
- The Game
that is about to start.player
- The Player
using this client.singlePlayerMode
- 'true' if the user wants to start a single player
game, 'false' otherwise.StartGamePanel
public void showServerListPanel(java.lang.String username, java.util.ArrayList<ServerInfo> serverList)
ServerListPanel
.
username
- The username that should be used when connecting to one
of the servers on the list.serverList
- The list containing the servers retrieved from the
metaserver.ServerListPanel
public DiplomaticTrade showNegotiationDialog(Unit unit, Settlement settlement, DiplomaticTrade agreement)
NegotiationDialog
.
NegotiationDialog
public void showPanel(FreeColPanel panel)
FreeColPanel
.
panel
- a FreeColPanel
valuepublic void showPanel(FreeColPanel panel, boolean centered)
FreeColPanel
.
panel
- a FreeColPanel
valuecentered
- a boolean
valuepublic void showSubPanel(FreeColPanel panel)
FreeColPanel
.
public void showChatPanel()
ChatPanel
.
ChatPanel
public void showModelMessages(ModelMessage... modelMessages)
modelMessages
- public javax.swing.ImageIcon getImageIcon(java.lang.Object display, boolean small)
display
- The Object to display.
public <T> T showFreeColDialog(FreeColDialog<T> freeColDialog)
freeColDialog
- The dialog to be displayed
reponse
returned by the dialog.public boolean showConfirmDialog(java.lang.String text, java.lang.String okText, java.lang.String cancelText, java.lang.String... replace)
text
- The text that explains the choice for the user.okText
- The text displayed on the "ok"-button.cancelText
- The text displayed on the "cancel"-button.replace
- An array of strings that will be inserted somewhere in the
text.
FreeColDialog
public boolean showConfirmDialog(ModelMessage[] messages, java.lang.String okText, java.lang.String cancelText)
messages
- The messages that explains the choice for the user.okText
- The text displayed on the "ok"-button.cancelText
- The text displayed on the "cancel"-button.
FreeColDialog
public boolean isClientOptionsDialogShowing()
ClientOptionsDialog
is visible.
true
if no internal frames are open.public boolean isMapboardActionsEnabled()
true
if no internal frames are open.public boolean isShowingSubPanel()
Canvas
displaying another panel.
Note that the previous implementation could throw exceptions in some cases, thus the change.
true
if the Canvas
is displaying an
internal frame.public LoadingSavegameDialog getLoadingSavegameDialog()
LoadingSavegameDialog
.
LoadingSavegameDialog
.public boolean showLoadingSavegameDialog(boolean publicServer, boolean singleplayer)
LoadingSavegameDialog
after calling this method.
publicServer
- Default value.singleplayer
- Default value.
true
if the "ok"-button was pressed and
false
otherwise.public boolean showClientOptionsDialog()
true
if the client options have been modified, and
false
otherwise.public boolean showMapGeneratorOptionsDialog(boolean editable)
editable
- The options are only allowed to be changed if this
variable is true
.
true
if the options have been modified, and
false
otherwise.public boolean showMapGeneratorOptionsDialog(boolean editable, MapGeneratorOptions mgo)
editable
- The options are only allowed to be changed if this
variable is true
.
true
if the options have been modified, and
false
otherwise.public java.io.File showLoadDialog(java.io.File directory)
showLoadDialog(directory, new FileFilter[] {FreeColDialog.getFSGFileFilter()});
directory
- The directory containing the files.
File
.FreeColDialog
public java.io.File showLoadDialog(java.io.File directory, javax.swing.filechooser.FileFilter[] fileFilters)
directory
- The directory containing the files.fileFilters
- The file filters which the user can select in the
dialog.
File
.FreeColDialog
public java.io.File showSaveDialog(java.io.File directory, java.lang.String defaultName)
showSaveDialog(directory, new FileFilter[] {FreeColDialog.getFSGFileFilter()}, defaultName);
directory
- The directory containing the files in which the user may
overwrite.defaultName
- Default filename for the savegame.
File
.FreeColDialog
public java.io.File showSaveDialog(java.io.File directory, java.lang.String standardName, javax.swing.filechooser.FileFilter[] fileFilters, java.lang.String defaultName)
directory
- The directory containing the files in which the user may
overwrite.standardName
- This extension will be added to the specified
filename (if not added by the user).fileFilters
- The available file filters in the dialog.defaultName
- Default filename for the savegame.
File
.FreeColDialog
public Canvas.BoycottAction showBoycottedGoodsDialog(Goods goods, Europe europe)
goods
- a Goods
valueeurope
- an Europe
value
boolean
valuepublic Canvas.ScoutAction showScoutIndianSettlementDialog(IndianSettlement settlement)
settlement
- The indian settlement that is being scouted.
public Canvas.ScoutAction showScoutForeignColonyDialog(Colony colony, Unit unit)
colony
- The foreign colony that is being scouted.
public Canvas.ScoutAction showArmedUnitIndianSettlementDialog(IndianSettlement settlement)
settlement
- The indian settlement that is going to be attacked or
demanded.
public java.util.List<java.lang.Object> showUseMissionaryDialog(IndianSettlement settlement)
settlement
- The indian settlement that is being visited.
public boolean showInciteDialog(Player enemy, int amount)
enemy
- The european player to attack.amount
- The amount of gold to pay.
public java.lang.String showInputDialog(java.lang.String text, java.lang.String defaultValue, java.lang.String okText, java.lang.String cancelText, java.lang.String... data)
text
- The text that explains the action to the user.defaultValue
- The default value appearing in the text field.okText
- The text displayed on the "ok"-button.cancelText
- The text displayed on the "cancel"-button. Use null
to disable the cancel-option.
FreeColDialog
public java.lang.String showInputDialog(java.lang.String text, java.lang.String defaultValue, java.lang.String okText, java.lang.String cancelText, boolean rejectEmptyString, java.lang.String... data)
text
- The text that explains the action to the user.defaultValue
- The default value appearing in the text field.okText
- The text displayed on the "ok"-button.cancelText
- The text displayed on the "cancel"-button. Use null
to disable the cancel-option.rejectEmptyString
- a boolean
value
FreeColDialog
public <T> T showChoiceDialog(java.lang.String text, java.lang.String cancelText, java.util.List<ChoiceItem<T>> choices)
Iterator
.
text
- The text that explains the choice for the user.cancelText
- The text displayed on the "cancel"-button.choices
- The List
containing the ChoiceItems to
create buttons for.
public <T> T showSimpleChoiceDialog(java.lang.String text, java.lang.String cancelText, java.util.List<T> objects)
text
- The text that explains the choice for the user.cancelText
- The text displayed on the "cancel"-button.objects
- The List containing the objects to create buttons for.
public void showStatusPanel(java.lang.String message)
Canvas
.
This includes all the showXXX
-methods. In addition,
closeStatusPanel()
also removes this panel.
message
- The text message to display on the status panel.StatusPanel
public void closeStatusPanel()
StatusPanel
.
showStatusPanel(java.lang.String)
public void showEuropePanel()
EuropePanel
.
EuropePanel
public int showEuropeDialog(EuropePanel.EuropeAction europeAction)
europeAction
- the type of panel to display
FreeColDialog.getResponseInt
.public void showColonyPanel(Colony colony)
Colony
.
colony
- The colony whose panel needs to be displayed.ColonyPanel
public Canvas.TradeAction showIndianSettlementTradeDialog(Settlement settlement, boolean showBuy, boolean showSell, boolean showGift)
IndianSettlement
.
settlement
- The native settlement to trade with.showBuy
- Show a "buy" option.showSell
- Show a "sell" option.showGift
- Show a "gift" option.public int showEmigrationPanel(boolean fountainOfYouth)
fountainOfYouth
- a boolean
value
public void remove(java.awt.Component comp)
remove
in class java.awt.Container
comp
- The component to remove from this Container.public void remove(java.awt.Component comp, boolean update)
comp
- The component to remove from this Container.update
- The Canvas
will be enabled, the graphics
repainted and both the menubar and the actions will be updated
if this parameter is true
.public java.awt.Component add(java.awt.Component comp)
add
in class java.awt.Container
comp
- The component to add
public java.awt.Component addCentered(java.awt.Component comp)
comp != statusPanel
).
comp
- The component to add
public javax.swing.JInternalFrame addAsFrame(javax.swing.JComponent comp)
comp != statusPanel
).
comp
- The component to add to this JInternalFrame.
JInternalFrame
that was created and added.public javax.swing.JInternalFrame addAsToolBox(javax.swing.JComponent comp)
comp != statusPanel
).
comp
- The component to add to this JInternalFrame.
JInternalFrame
that was created and added.public javax.swing.JInternalFrame addAsSimpleFrame(javax.swing.JComponent comp)
comp != statusPanel
).
The frame cannot be moved or resized.
comp
- The component to add to this ToEuropePanel.
JInternalFrame
that was created and added.public void deactivateMovable(javax.swing.JComponent c)
c
- The component the listeners should be removed from.public void addCentered(java.awt.Component comp, java.lang.Integer i)
comp != statusPanel
).
comp
- The component to add to this ToEuropePanel.i
- The layer to add the component to (see JLayeredPane).public void add(java.awt.Component comp, java.lang.Integer i)
comp != statusPanel
).
comp
- The component to add to this ToEuropePanel.i
- The layer to add the component to (see JLayeredPane).public void add(java.awt.Component comp, java.lang.Integer i, boolean update)
comp != statusPanel
).
comp
- The component to add to this ToEuropePanel.i
- The layer to add the component to (see JLayeredPane).public EuropePanel getEuropePanel()
EuropePanel
.
EuropePanel
.public MapControls getMapControls()
MapControls
valuepublic void showPopup(javax.swing.JPopupMenu popup, int x, int y)
popup
- The JPopupMenu to show.x
- The x-coordinate at which to show the popup.y
- The y-coordinate at which to show the popup.public void showTilePopup(Map.Position pos, int x, int y)
pos
- The coordinates of the Tile where the popup occurred.x
- The x-coordinate on the screen where the popup needs to be
placed.y
- The y-coordinate on the screen where the popup needs to be
placed.TilePopup
public void errorMessage(java.lang.String messageID)
messageID
- The i18n-keyname of the error message to display.public void errorMessage(java.lang.String messageID, java.lang.String message)
messageID
- The i18n-keyname of the error message to display.message
- An alternative message to display if the resource specified
by messageID
is unavailable.public void showInformationMessage(java.lang.String messageId)
messageId
- The messageId of the message to display.public void showInformationMessage(java.lang.String messageId, FreeColObject displayObject)
messageId
- The messageId of the message to display.displayObject
- Optional object for displaying an iconpublic void showInformationMessage(java.lang.String messageId, java.lang.String... replace)
canvas.showInformationMessage("noNeedForTheGoods", "%goods%", goods.getName());
messageId
- The messageId of the message to display.replace
- All occurrences of replace[2x]
in the
message gets replaced by replace[2x+1]
.public void showInformationMessage(java.lang.String messageId, FreeColObject displayObject, java.lang.String... replace)
canvas.showInformationMessage("noNeedForTheGoods", "%goods%", goods.getName());
messageId
- The messageId of the message to display.replace
- All occurrences of replace[2x]
in the
message gets replaced by replace[2x+1]
.displayObject
- Optional object for displaying an iconpublic void refresh()
public void refreshTile(int x, int y)
x
- The x-coordinate of the Tile to refresh.y
- The y-coordinate of the Tile to refresh.public void refreshTile(Tile t)
t
- The tile to refresh.public void refreshTile(Map.Position p)
p
- The position of the tile to refresh.public void closeMenus()
public void showMainPanel()
MainPanel
.
MainPanel
public void showOpeningVideoPanel()
VideoPanel
.
public MainPanel getMainPanel()
MainPanel
.
MainPanel
.MainPanel
public void closeMainPanel()
MainPanel
.
public void showOpenGamePanel()
OpenGamePanel
.
public StartGamePanel getStartGamePanel()
StartGamePanel
that lies in this container.
StartGamePanel
.StartGamePanel
public void displayChatMessage(Player sender, java.lang.String message, boolean privateChat)
sender
- The player who sent the chat message to the server.message
- The chat message.privateChat
- 'true' if the message is a private one, 'false'
otherwise.GUIMessage
public void displayChatMessage(java.lang.String message)
message
- The chat message.public void quit()
showConfirmDialog(String, String, String, String...)
in
order to get a "Are you sure"-confirmation from the user.
public void retire()
showConfirmDialog(String, String, String, String...)
in
order to get a "Are you sure"-confirmation from the user.
public void returnToTitle()
public void removeInGameComponents()
public boolean containsInGameComponents()
Canvas
contains any ingame components.
true
if there is a single ingame component.public GUI getGUI()
Canvas
's GUI
.
GUI
.public FreeColClient getClient()
freeColClient
associated with this
Canvas
.public void newGame()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |