Class CanvasDrawerGUI
java.lang.Object
madkit.gui.DefaultAgentGUI
madkit.simulation.viewer.ViewerDefaultGUI
madkit.simulation.viewer.CanvasDrawerGUI
CanvasDrawerGUI extends
ViewerDefaultGUI
so that a canvas is used for rendering
the simulation.-
Constructor Summary
ConstructorsConstructorDescriptionCanvasDrawerGUI
(Viewer viewer) Creates a new CanvasDrawerGUI with the specified viewer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the canvas by filling it with the background color.protected Node
Creates the central node of the GUI.protected Node
Creates the top node of the GUI.Sets the background color of the canvas.Gets the canvasGets the graphics context of the canvas.void
setBackground
(Color background) Sets the background color of the canvas.void
setCanvasSize
(int width, int height) Sets the size of the canvas.Methods inherited from class madkit.simulation.viewer.ViewerDefaultGUI
createBottomNode, createRightNode, createToolBar, getRenderingOffAction, getSynchroPaintingAction, getViewer, isRendering, onInitialize, requestRendering, setRenderingOff, setSynchroPainting
Methods inherited from class madkit.gui.DefaultAgentGUI
createLeftNode, getAgent, getBottomNode, getCenterNode, getLeftNode, getMainPane, getRightNode, getScene, getStage, getToolbar, getToolBar, getTopNode
-
Constructor Details
-
CanvasDrawerGUI
Creates a new CanvasDrawerGUI with the specified viewer.- Parameters:
viewer
- the viewer associated with this GUI.
-
-
Method Details
-
createTopNode
Creates the top node of the GUI. It adds a color picker to the menu bar to allow the user to select the background color of the canvas.- Overrides:
createTopNode
in classViewerDefaultGUI
- Returns:
- a VBox containing the menu bar
-
createCenterNode
Creates the central node of the GUI. It returns a canvas.- Specified by:
createCenterNode
in classViewerDefaultGUI
- Returns:
- the central node of the main pane
-
getGraphics
Gets the graphics context of the canvas.- Returns:
- the graphics context of the canvas.
-
getCanvas
-
clearCanvas
public void clearCanvas()Clears the canvas by filling it with the background color. -
setCanvasSize
public void setCanvasSize(int width, int height) Sets the size of the canvas.- Parameters:
width
- the width of the canvas.height
- the height of the canvas.
-
getBackground
Sets the background color of the canvas.- Returns:
- the background color of the canvas.
-
setBackground
Sets the background color of the canvas.- Parameters:
background
- the background to set
-