Package net.sf.jaxodraw.gui
Interface JaxoCanvasComponent
- All Known Subinterfaces:
JaxoDrawingArea
- All Known Implementing Classes:
AbstractJaxoCanvas
,JaxoCanvas
public interface JaxoCanvasComponent
The canvas as a component.
- Since:
- 2.1
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the specified mouse listener to receive mouse events from this CanvasComponent.void
Adds the specified mouse motion listener to receive mouse motion events from this CanvasComponent.void
Adds a PropertyChangeListener to the listener list.Return this CanvasComponent as a Component.Background color in the region that is actually covered by the canvasgetCanvasSize()
.Part of the component that is covered by the actual canvas.Origin of the actual canvas within the component.Canvas size.Return the graphics context of this CanvasComponent.Maximum size of the canvas (even if there are objects with a larger bounding box).Minimum size of the canvas (even if there are no objects or they have a smaller bounding box).void
Prints this component.void
Removes the specified mouse listener so that it no longer receives mouse events from this component.void
Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component.void
repaint()
Repaints this component.void
setCanvasBackground
(Color color) Sets the color of the background.void
setMaximumCanvasSize
(Dimension value) Sets the maximum canvas size.void
setMinimumCanvasSize
(Dimension value) Sets the minimum canvas size.
-
Method Details
-
addMouseListener
Adds the specified mouse listener to receive mouse events from this CanvasComponent.- Parameters:
l
- the mouse listener. May be null.- See Also:
-
addMouseMotionListener
Adds the specified mouse motion listener to receive mouse motion events from this CanvasComponent.- Parameters:
l
- the mouse motion listener. May be null.- See Also:
-
addPropertyChangeListener
Adds a PropertyChangeListener to the listener list.- Parameters:
listener
- the property change listener to be added. May be null.- See Also:
-
asComponent
Component asComponent()Return this CanvasComponent as a Component.- Returns:
- this CanvasComponent as a Component or null, if this is not a Component.
-
getCanvasBackground
Color getCanvasBackground()Background color in the region that is actually covered by the canvasgetCanvasSize()
.- Returns:
- The canvas background color.
-
getCanvasBounds
Rectangle getCanvasBounds()Part of the component that is covered by the actual canvas. This includes canvas background and grid, -- i.e. a rectangle with size 'canvasSize' and origin 'canvasOrigin'.- Returns:
- Rectangle the canvas bounds.
- See Also:
-
getCanvasOrigin
Point getCanvasOrigin()Origin of the actual canvas within the component. This is always the top-left corner.- Returns:
- a Point at the origin.
-
getCanvasSize
Dimension getCanvasSize()Canvas size. This is equal to the (inner) component size unless because of viewport size tracking, the component has become larger than the effective maximum canvas size.- Returns:
- The canvas size.
-
getGraphics
Graphics getGraphics()Return the graphics context of this CanvasComponent.- Returns:
- the graphics context or null if this component is currently not displayable.
- See Also:
-
getMaximumCanvasSize
Dimension getMaximumCanvasSize()Maximum size of the canvas (even if there are objects with a larger bounding box). The default value is larger than (0,0). If the maximum canvas size is smaller (in either direction) than the minimum canvas size, the latter wins.- Returns:
- The maximum canvas size.
-
getMinimumCanvasSize
Dimension getMinimumCanvasSize()Minimum size of the canvas (even if there are no objects or they have a smaller bounding box). The default value is (0,0).- Returns:
- The minimum canvas size.
-
print
Prints this component.- Parameters:
g
- the graphics context to use for printing.- See Also:
-
removeMouseListener
Removes the specified mouse listener so that it no longer receives mouse events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listener l is null, no exception is thrown and no action is performed.- Parameters:
l
- the mouse listener- See Also:
-
removeMouseMotionListener
Removes the specified mouse motion listener so that it no longer receives mouse motion events from this component. This method performs no function, nor does it throw an exception, if the listener specified by the argument was not previously added to this component. If listener l is null, no exception is thrown and no action is performed.- Parameters:
l
- the mouse motion listener- See Also:
-
repaint
void repaint()Repaints this component.- See Also:
-
setCanvasBackground
Sets the color of the background.- Parameters:
color
- The background color.
-
setMaximumCanvasSize
Sets the maximum canvas size.- Parameters:
value
- The maximum canvas size.
-
setMinimumCanvasSize
Sets the minimum canvas size.- Parameters:
value
- The minimum canvas size.
-