Package net.sf.freecol.client.gui
Class Canvas
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JLayeredPane
-
- javax.swing.JDesktopPane
-
- net.sf.freecol.client.gui.Canvas
-
- All Implemented Interfaces:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,javax.accessibility.Accessible
public final class Canvas extends javax.swing.JDesktopPaneThe main container for the other GUI components in FreeCol. This is where lower level graphics coordination occurs. Specific panels and dialogs are over in Widgets (TODO) with a few exceptions.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classCanvas.ToolBoxFrameA class for frames being used as tool boxes.-
Nested classes/interfaces inherited from class javax.swing.JDesktopPane
javax.swing.JDesktopPane.AccessibleJDesktopPane
-
Nested classes/interfaces inherited from class javax.swing.JLayeredPane
javax.swing.JLayeredPane.AccessibleJLayeredPane
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.TimeranimationTimerA timer triggering repaints in order to display animations on theCanvasMapViewer.private CanvasMapViewercanvasMapViewerThe panel used for displaying the map and drawing the background of this class.private java.util.List<FreeColDialog<?>>dialogsThe dialogs in view.private FreeColClientfreeColClientThe game client.static java.awt.CursorGO_CURSORThe cursor to show for goto operations.private java.awt.GraphicsDevicegraphicsDeviceThe graphics device to display to.private GrayLayergreyLayerThe special overlay used when it is not the player turn.private static java.util.logging.Loggerloggerprivate MainPanelmainPanelThe main panel.private MapControlsmapControlsThe various sorts of map controls.private MapViewermapViewerThe component that displays the map.private static intMAXTRYNumber of tries to find a clear spot on the canvas.private java.awt.DimensionoldSizeRemember the current size (from getSize()), check for changes.private FreeColFrameparentFrameThe parent frame, either a window or the full screen.private booleanwindowedIs the canvas in windowed 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
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description Canvas(FreeColClient freeColClient, java.awt.GraphicsDevice graphicsDevice, java.awt.Dimension desiredSize, MapViewer mapViewer, MapControls mapControls)The constructor to use.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private javax.swing.JInternalFrameaddAsFrame(javax.swing.JComponent comp, boolean toolBox, SwingGUI.PopupPosition popupPosition, boolean resizable)Adds a component on this Canvas inside a frame.private voidaddCentered(java.awt.Component comp, java.lang.Integer layer)Adds a component centered on this Canvas.booleanaddMapControls()Add the map controls.private voidaddToCanvas(java.awt.Component comp, java.lang.Integer layer)Adds a component to this Canvas updating the menus.private voidaddToLayer(java.awt.Component comp, java.lang.Integer layer)Adds a component to this Canvas.voidanimationLabel(javax.swing.JLabel label, boolean add)Add and remove animation labels.private static booleancheckWindowed(java.awt.GraphicsDevice gd, java.awt.Dimension desiredSize)Determine whether to use full screen or windowed mode.private java.awt.PointchooseLocation(java.awt.Component comp, int width, int height, SwingGUI.PopupPosition popupPosition)Choose a location for a component.voidcloseMainPanel()Closes theMainPanel.voidcloseMenus()Closes all the menus that are currently open.voidclosePanel(java.lang.String panel)Close a panel by class name.private FreeColFramecreateFrame(javax.swing.JMenuBar menuBar, java.awt.Rectangle windowBounds)Create a new frame with a given menu bar and bounds.private voiddestroyFrame()Destroy the current frame.voiddialogAdd(FreeColDialog<?> fcd)Add a dialog to the current dialog list.voiddialogRemove(FreeColDialog<?> fcd)Remove a dialog from the current dialog list.private java.awt.PointgetClearSpace(int x, int y, int w, int h, int tries)Try to find some free space on the canvas for a component, starting at x,y.FreeColDialog<?>getExistingFreeColDialog(java.lang.Class<?> type)Get a currentlydisplayed FreeColDialog of a given type.<T extends FreeColPanel>
TgetExistingFreeColPanel(java.lang.Class<T> type)Gets a currently displayed FreeColPanel of a given type.private javax.swing.JInternalFramegetInternalFrame(java.awt.Component c)Gets the internal frame for the given component.java.awt.ComponentgetMatchingComponent(java.util.function.Predicate<java.awt.Component> pred)Gets any currently displayed component matching a predicate.FreeColFramegetParentFrame()Get the parent frame.private java.awt.PointgetSavedPosition(java.awt.Component comp)Gets the saved position of a component.private java.awt.DimensiongetSavedSize(java.awt.Component comp)Get the saved size of a component.java.awt.ComponentgetShowingPanel()Get any panel thisCanvasis displaying.voidinitializeInGame()In game initializations.booleanisWindowed()Are we in windowed mode?voidmainTitle()Closes all panels, changes the background and shows the main menu.private booleannothingShowing()Is nothing showing?private voidnotifyClose(java.awt.Component c, javax.swing.JInternalFrame jif)A component is closing.voidpaintComponent(java.awt.Graphics g)voidpaintJustTheMapImmediately()voidplayVideo(java.lang.String videoId, boolean muteAudio, java.lang.Runnable runnable)Play the opening video.voidprepareShowingMainMenu()voidquit()Quit the canvas.voidremove(java.awt.Component comp)voidremoveFromCanvas(java.awt.Component comp)Removes the given component from this canvas without updating the menu bar.voidremoveInGameComponents()Removes components that is only used when in game.booleanremoveMapControls()Remove the map controls.voidresetMenuBar()Reset the menu bar.voidrestoreSavedSize(java.awt.Component comp, java.awt.Dimension d)Set preferred size to saved size, or to the givenDimensionif no saved size was found.private voidsaveInteger(java.lang.String className, java.lang.String key, int value)Save anintvalue to the saved ClientOptions, using the name of the components class plus the given key as and identifier.private voidsavePosition(java.awt.Component comp, java.awt.Point position)Save the position of a component.private voidsaveSize(java.awt.Component comp, java.awt.Dimension size)Save the size of a component.<T> TshowFreeColDialog(FreeColDialog<T> dialog, SwingGUI.PopupPosition pos)Displays the given dialog, optionally making sure a tile is visible.FreeColPanelshowFreeColPanel(FreeColPanel panel, SwingGUI.PopupPosition popupPosition, boolean resizable)Displays aFreeColPanelat a generalized position.FreeColPanelshowMainPanel()Shows theMainPanel.voidshowMapEditorTransformPanel()Display the map editor transform panel.voidstartMapEditorGUI()Map editor initialization.voidtoggleFrame()Toggle the frame between windowed and non-windowed modes.private voidtoggleWindowed()Toggle windowed flag.voidupdateMenuBar()Update the menu bar.private voidupdateSize()<T> voidviewFreeColDialog(FreeColDialog<T> freeColDialog, SwingGUI.PopupPosition pos)Displays the given dialog, optionally making sure a tile is visible.-
Methods inherited from class javax.swing.JDesktopPane
addImpl, getAccessibleContext, getAllFrames, getAllFramesInLayer, getDesktopManager, getDragMode, getSelectedFrame, getUI, getUIClassID, paramString, remove, removeAll, selectFrame, setComponentZOrder, setDesktopManager, setDragMode, setSelectedFrame, setUI, updateUI
-
Methods inherited from class javax.swing.JLayeredPane
getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, 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, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, 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, processContainerEvent, processEvent, removeContainerListener, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
MAXTRY
private static final int MAXTRY
Number of tries to find a clear spot on the canvas.- See Also:
- Constant Field Values
-
GO_CURSOR
public static final java.awt.Cursor GO_CURSOR
The cursor to show for goto operations.
-
freeColClient
private final FreeColClient freeColClient
The game client.
-
graphicsDevice
private final java.awt.GraphicsDevice graphicsDevice
The graphics device to display to.
-
windowed
private boolean windowed
Is the canvas in windowed mode?
-
parentFrame
private FreeColFrame parentFrame
The parent frame, either a window or the full screen.
-
oldSize
private java.awt.Dimension oldSize
Remember the current size (from getSize()), check for changes.
-
mapViewer
private final MapViewer mapViewer
The component that displays the map. Ideally this would be completely separate, but the displayMap (and possibly changeSize) call/s means we must retain a reference to the map viewer. We also use it for the Cursor, which remains in MapViewer so that displayMap can draw it when active needed.
-
mapControls
private MapControls mapControls
The various sorts of map controls.
-
greyLayer
private GrayLayer greyLayer
The special overlay used when it is not the player turn.
-
dialogs
private final java.util.List<FreeColDialog<?>> dialogs
The dialogs in view.
-
mainPanel
private MainPanel mainPanel
The main panel. Remember this because getExistingFreeColPanel gets confused across switches between the game and the map editor which makes it hard to remove.
-
canvasMapViewer
private CanvasMapViewer canvasMapViewer
The panel used for displaying the map and drawing the background of this class.
-
animationTimer
private javax.swing.Timer animationTimer
A timer triggering repaints in order to display animations on theCanvasMapViewer.
-
-
Constructor Detail
-
Canvas
public Canvas(FreeColClient freeColClient, java.awt.GraphicsDevice graphicsDevice, java.awt.Dimension desiredSize, MapViewer mapViewer, MapControls mapControls)
The constructor to use.- Parameters:
freeColClient- TheFreeColClientfor the game.graphicsDevice- TheGraphicsDeviceto display on.desiredSize- The desired size of the parent frame.mapViewer- The object responsible of drawing the map.mapControls- The controls on the map.
-
-
Method Detail
-
updateSize
private void updateSize()
-
toggleWindowed
private void toggleWindowed()
Toggle windowed flag.
-
createFrame
private FreeColFrame createFrame(javax.swing.JMenuBar menuBar, java.awt.Rectangle windowBounds)
Create a new frame with a given menu bar and bounds.- Parameters:
menuBar- The new framesJMenuBar.windowBounds- The new frame boundingRectangle.- Returns:
- The new
FreeColFrame.
-
destroyFrame
private void destroyFrame()
Destroy the current frame.
-
checkWindowed
private static boolean checkWindowed(java.awt.GraphicsDevice gd, java.awt.Dimension desiredSize)Determine whether to use full screen or windowed mode.- Parameters:
gd- TheGraphicsDeviceto display to.desiredSize- An optional windowDimension.- Returns:
- True if windowed mode is to be used, false for full screen.
-
addAsFrame
private javax.swing.JInternalFrame addAsFrame(javax.swing.JComponent comp, boolean toolBox, SwingGUI.PopupPosition popupPosition, boolean resizable)Adds a component on this Canvas inside a frame.- Parameters:
comp- The component to add to the canvas.toolBox- Should be set to true if the resulting frame is used as a toolbox (that is: it should not be counted as a frame).popupPosition- A preferredPopupPosition.resizable- Whether this component can be resized.- Returns:
- The
JInternalFramethat was created and added.
-
addCentered
private void addCentered(java.awt.Component comp, java.lang.Integer layer)Adds a component centered on this Canvas.- Parameters:
comp- TheComponentto add to this canvas.layer- The layer to add the component to (see JLayeredPane).
-
addToLayer
private void addToLayer(java.awt.Component comp, java.lang.Integer layer)Adds a component to this Canvas.- Parameters:
comp- TheComponentto add to this canvas.layer- The layer to add the component to (see JLayeredPane).
-
addToCanvas
private void addToCanvas(java.awt.Component comp, java.lang.Integer layer)Adds a component to this Canvas updating the menus.- Parameters:
comp- TheComponentto add to this canvas.layer- The layer to add the component to (see JLayeredPane).
-
getInternalFrame
private javax.swing.JInternalFrame getInternalFrame(java.awt.Component c)
Gets the internal frame for the given component.- Parameters:
c- TheComponent.- Returns:
- The given component if this is an internal frame or the
first parent that is an internal frame. Returns
nullif no internal frame is found.
-
nothingShowing
private boolean nothingShowing()
Is nothing showing?- Returns:
- True if no dialog or panel is being shown.
-
chooseLocation
private java.awt.Point chooseLocation(java.awt.Component comp, int width, int height, SwingGUI.PopupPosition popupPosition)Choose a location for a component.- Parameters:
comp- TheComponentto place.width- The component width to use.height- The component height to use.popupPosition- An optionalPopupPositionhint.- Returns:
- A suitable
Pointto place the component.
-
getClearSpace
private java.awt.Point getClearSpace(int x, int y, int w, int h, int tries)Try to find some free space on the canvas for a component, starting at x,y.- Parameters:
x- A starting x coordinate.y- A starting y coordinate.w- The component width to use.h- The component height to use.tries- The number of attempts to find a clear space.- Returns:
- A
Pointto place the component at or null on failure.
-
getSavedPosition
private java.awt.Point getSavedPosition(java.awt.Component comp)
Gets the saved position of a component.- Parameters:
comp- TheComponentto use.- Returns:
- The saved position as a
Point, or null if no saved position is found.
-
getSavedSize
private java.awt.Dimension getSavedSize(java.awt.Component comp)
Get the saved size of a component.- Parameters:
comp- TheComponentto use.- Returns:
- A
Dimensionfor the component or null if no saved size is found.
-
saveInteger
private void saveInteger(java.lang.String className, java.lang.String key, int value)Save anintvalue to the saved ClientOptions, using the name of the components class plus the given key as and identifier.- Parameters:
className- The class name for the component.key- The key to save.value- The value to save.
-
savePosition
private void savePosition(java.awt.Component comp, java.awt.Point position)Save the position of a component.- Parameters:
comp- TheComponentto use.position- The position to save.
-
saveSize
private void saveSize(java.awt.Component comp, java.awt.Dimension size)Save the size of a component.- Parameters:
comp- TheComponentto use.size- TheDimensionto save.
-
notifyClose
private void notifyClose(java.awt.Component c, javax.swing.JInternalFrame jif)A component is closing. Some components need position and size to be saved.- Parameters:
c- The closingComponent.jif- The enclosingJInternalFrame.
-
removeInGameComponents
public void removeInGameComponents()
Removes components that is only used when in game.
-
startMapEditorGUI
public void startMapEditorGUI()
Map editor initialization.
-
initializeInGame
public void initializeInGame()
In game initializations.
-
quit
public void quit()
Quit the canvas.
-
restoreSavedSize
public void restoreSavedSize(java.awt.Component comp, java.awt.Dimension d)Set preferred size to saved size, or to the givenDimensionif no saved size was found. Call this method in the constructor of a FreeColPanel in order to remember its size and position.- Parameters:
comp- TheComponentto use.d- TheDimensionto use as default.
-
animationLabel
public void animationLabel(javax.swing.JLabel label, boolean add)Add and remove animation labels.- Parameters:
label- AJLabelfor an animation.add- If true, add the label, else remove it.
-
closePanel
public void closePanel(java.lang.String panel)
Close a panel by class name.- Parameters:
panel- The panel to close.
-
dialogAdd
public void dialogAdd(FreeColDialog<?> fcd)
Add a dialog to the current dialog list.- Parameters:
fcd- The dialog to add.
-
dialogRemove
public void dialogRemove(FreeColDialog<?> fcd)
Remove a dialog from the current dialog list.- Parameters:
fcd- The dialog to remove.
-
getExistingFreeColDialog
public FreeColDialog<?> getExistingFreeColDialog(java.lang.Class<?> type)
Get a currentlydisplayed FreeColDialog of a given type.- Parameters:
type- The class of dialog to look for.- Returns:
- The
FreeColDialogfound, or null if none present.
-
getExistingFreeColPanel
public <T extends FreeColPanel> T getExistingFreeColPanel(java.lang.Class<T> type)
Gets a currently displayed FreeColPanel of a given type.- Type Parameters:
T- The actual panel type.- Parameters:
type- The type ofFreeColPanelto look for.- Returns:
- A currently displayed
FreeColPanelof the requested type, or null if none found.
-
getMatchingComponent
public java.awt.Component getMatchingComponent(java.util.function.Predicate<java.awt.Component> pred)
Gets any currently displayed component matching a predicate.- Parameters:
pred- The predicate to apply.- Returns:
- The first match for the predicate, or null if none found.
-
getShowingPanel
public java.awt.Component getShowingPanel()
Get any panel thisCanvasis displaying.- Returns:
- A
ComponenttheCanvasis displaying, or null if none found.
-
removeFromCanvas
public void removeFromCanvas(java.awt.Component comp)
Removes the given component from this canvas without updating the menu bar.- Parameters:
comp- TheComponentto remove.
-
showFreeColDialog
public <T> T showFreeColDialog(FreeColDialog<T> dialog, SwingGUI.PopupPosition pos)
Displays the given dialog, optionally making sure a tile is visible.- Type Parameters:
T- The type to be returned from the dialog.- Parameters:
dialog- TheFreeColDialogto be displayedpos- APopupPositionfor the dialog.- Returns:
- The
reponsereturned by the dialog.
-
showFreeColPanel
public FreeColPanel showFreeColPanel(FreeColPanel panel, SwingGUI.PopupPosition popupPosition, boolean resizable)
Displays aFreeColPanelat a generalized position.- Parameters:
panel-FreeColPanel, panel to showpopupPosition-PopupPositionThe generalized position to place the panel.resizable- Should the panel be resizable?- Returns:
- The panel.
-
viewFreeColDialog
public <T> void viewFreeColDialog(FreeColDialog<T> freeColDialog, SwingGUI.PopupPosition pos)
Displays the given dialog, optionally making sure a tile is visible.- Type Parameters:
T- The type to be returned from the dialog.- Parameters:
freeColDialog- The dialog to be displayedpos- APopupPositionfor the dialog.
-
isWindowed
public boolean isWindowed()
Are we in windowed mode?- Returns:
- True if in windowed mode.
-
getParentFrame
public FreeColFrame getParentFrame()
Get the parent frame. Do not use this except inside Widgets (which is really just an extension of Canvas).- Returns:
- The parent
FreeColFrame.
-
toggleFrame
public void toggleFrame()
Toggle the frame between windowed and non-windowed modes.
-
addMapControls
public boolean addMapControls()
Add the map controls.- Returns:
- True if any were added.
-
removeMapControls
public boolean removeMapControls()
Remove the map controls.- Returns:
- True if any were removed.
-
closeMenus
public void closeMenus()
Closes all the menus that are currently open.
-
resetMenuBar
public void resetMenuBar()
Reset the menu bar.
-
updateMenuBar
public void updateMenuBar()
Update the menu bar.
-
playVideo
public void playVideo(java.lang.String videoId, boolean muteAudio, java.lang.Runnable runnable)Play the opening video.- Parameters:
videoId- An identifier for the video content.muteAudio- Mute if true.runnable- ARunnableto run on completion.
-
closeMainPanel
public void closeMainPanel()
Closes theMainPanel.
-
mainTitle
public void mainTitle()
Closes all panels, changes the background and shows the main menu.
-
showMainPanel
public FreeColPanel showMainPanel()
Shows theMainPanel.- Returns:
- The main panel.
-
prepareShowingMainMenu
public void prepareShowingMainMenu()
-
showMapEditorTransformPanel
public void showMapEditorTransformPanel()
Display the map editor transform panel.
-
paintJustTheMapImmediately
public void paintJustTheMapImmediately()
-
paintComponent
public void paintComponent(java.awt.Graphics g)
- Overrides:
paintComponentin classjavax.swing.JComponent
-
remove
public void remove(java.awt.Component comp)
- Overrides:
removein classjavax.swing.JDesktopPane
-
-