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
 void addMouseListener(MouseListener l)
          Adds the specified mouse listener to receive mouse events from this CanvasComponent.
 void addMouseMotionListener(MouseMotionListener l)
          Adds the specified mouse motion listener to receive mouse motion events from this CanvasComponent.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 Component asComponent()
          Return this CanvasComponent as a Component.
 Color getCanvasBackground()
          Background color in the region that is actually covered by the canvas getCanvasSize().
 Rectangle getCanvasBounds()
          Part of the component that is covered by the actual canvas.
 Point getCanvasOrigin()
          Origin of the actual canvas within the component.
 Dimension getCanvasSize()
          Canvas size.
 Graphics getGraphics()
          Return the graphics context of this CanvasComponent.
 Dimension getMaximumCanvasSize()
          Maximum size of the canvas (even if there are objects with a larger bounding box).
 Dimension getMinimumCanvasSize()
          Minimum size of the canvas (even if there are no objects or they have a smaller bounding box).
 void print(Graphics g)
          Prints this component.
 void removeMouseListener(MouseListener l)
          Removes the specified mouse listener so that it no longer receives mouse events from this component.
 void removeMouseMotionListener(MouseMotionListener l)
          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 Detail

addMouseListener

void addMouseListener(MouseListener l)
Adds the specified mouse listener to receive mouse events from this CanvasComponent.

Parameters:
l - the mouse listener. May be null.
See Also:
Component.addMouseListener(java.awt.event.MouseListener)

addMouseMotionListener

void addMouseMotionListener(MouseMotionListener l)
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:
Component.addMouseMotionListener(java.awt.event.MouseMotionListener)

addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list.

Parameters:
listener - the property change listener to be added. May be null.
See Also:
Component.addPropertyChangeListener(java.beans.PropertyChangeListener)

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 canvas getCanvasSize().

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:
getCanvasSize(), getCanvasOrigin()

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:
Component.getGraphics()

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

void print(Graphics g)
Prints this component.

Parameters:
g - the graphics context to use for printing.
See Also:
Component.print(java.awt.Graphics)

removeMouseListener

void removeMouseListener(MouseListener l)
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:
Component.removeMouseListener(java.awt.event.MouseListener)

removeMouseMotionListener

void removeMouseMotionListener(MouseMotionListener l)
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:
Component.removeMouseMotionListener(java.awt.event.MouseMotionListener)

repaint

void repaint()
Repaints this component.

See Also:
Component.repaint()

setCanvasBackground

void setCanvasBackground(Color color)
Sets the color of the background.

Parameters:
color - The background color.

setMaximumCanvasSize

void setMaximumCanvasSize(Dimension value)
Sets the maximum canvas size.

Parameters:
value - The maximum canvas size.

setMinimumCanvasSize

void setMinimumCanvasSize(Dimension value)
Sets the minimum canvas size.

Parameters:
value - The minimum canvas size.


Copyright © 2003-2011 The JaxoDraw team. All Rights Reserved.