|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjsky.image.graphics.gui.CanvasDraw
public class CanvasDraw
This class defines a set of AbstractAction objects for drawing on the image. These can be used for menu items or buttons in the user interface.
Field Summary | |
---|---|
protected javax.swing.event.ChangeEvent |
changeEvent
Event fired for changes |
protected javax.swing.AbstractAction |
clearAction
Action to use to remove all figures. |
static java.lang.String[] |
COLOR_NAMES
Colors names corresponding to the above array |
static java.awt.Color[] |
COLORS
Colors for color change actions |
protected java.awt.Composite |
composite
Current composite |
static java.lang.String[] |
COMPOSITE_NAMES
Display names for Composites |
protected javax.swing.AbstractAction[] |
compositeActions
Actions to use to set the composite |
static java.awt.Composite[] |
COMPOSITES
Composites |
protected javax.swing.AbstractAction |
deleteSelectedAction
Action to use to delete the selected figure. |
static java.lang.String[] |
DRAWING_MODES
Drawing mode action names |
protected int |
drawingMode
Current drawing mode |
protected javax.swing.AbstractAction[] |
drawingModeActions
Drawing mode actions |
static int |
ELLIPSE
Mode to draw an ellipse |
protected diva.canvas.AbstractFigure |
figure
Current figure (during figure creation) |
protected java.util.LinkedList |
figureList
List of figures created by this instance |
protected java.awt.Paint |
fill
Current fill paint |
protected javax.swing.AbstractAction[] |
fillActions
Actions to use to set the fill color |
protected java.awt.Font |
font
Default font for text items (labels can be resized afterwards) |
protected javax.swing.AbstractAction[] |
fontActions
Actions to use to set the font |
static java.awt.Font[] |
FONTS
Fonts for font change actions |
protected diva.util.java2d.Polyline2D.Double |
freehand
Used while drawing freehand |
static int |
FREEHAND
Mode to draw a free-hand figure |
protected DivaImageGraphics |
graphics
Object managing image graphics |
protected javax.swing.AbstractAction |
hideGraphicsAction
Action to use to toggle the visibility of all figures. |
protected DivaMainImageDisplay |
imageDisplay
The target image display. |
static int |
LINE
Mode to draw a line |
static int[] |
LINE_WIDTHS
Supported line widths |
protected int |
lineWidth
Current line width |
protected javax.swing.AbstractAction[] |
lineWidthActions
Actions to use to set the line width |
protected javax.swing.event.EventListenerList |
listenerList
list of listeners for change events |
protected boolean |
mouseClicked
True if mouse was clicked |
static int |
NUM_COLORS
The number of colors for which fill and outline actions are defined. |
static int |
NUM_COMPOSITES
The number of composites defined above |
static int |
NUM_DRAWING_MODES
The number of drawing modes. |
static int |
NUM_FONTS
The number of fonts for which actions are defined. |
static int |
NUM_LINE_WIDTHS
Number of Supported line widths |
protected java.awt.Paint |
outline
Current outline paint |
protected javax.swing.AbstractAction[] |
outlineActions
Actions to use to set the outline color |
protected diva.util.java2d.Polygon2D.Double |
polygon
Used while drawing a polygon |
static int |
POLYGON
Mode to draw a polygon |
protected diva.util.java2d.Polyline2D.Double |
polyline
Used while drawing a polyline |
static int |
POLYLINE
Mode to draw a polyline |
static int |
RECTANGLE
Mode to draw a rectangle |
static int |
REGION
Mode to select objects in a rectangular region |
static int |
SELECT
Mode to select an object |
protected int |
startX
Starting point of drag |
protected int |
startY
Starting point of drag |
static int |
TEXT
Mode to insert a text label |
protected boolean |
visible
Used to toggle the visibility of all figures |
Constructor Summary | |
---|---|
CanvasDraw(DivaMainImageDisplay imageDisplay)
Create a menu with graphics related items. |
Method Summary | |
---|---|
void |
addChangeListener(javax.swing.event.ChangeListener l)
register to receive change events from this object whenever the drawing settings are changed. |
void |
addFigure(CanvasFigure fig)
Add the given figure to the list of managed figures. |
void |
clear()
Remove all figures created by this instance. |
void |
deleteSelected()
Delete the selected figures. |
protected void |
finishFigure()
Finish off the current figure and select it |
protected void |
fireChange()
Notify any listeners of a change in the image or cut levels. |
java.awt.Composite |
getComposite()
Return the current composite composite for drawing. |
javax.swing.AbstractAction |
getCompositeAction(int i)
Return the action for the given composite composite |
int |
getDrawingMode()
Return the current drawing mode |
javax.swing.AbstractAction |
getDrawingModeAction(int drawingMode)
Return the action for the given mode |
java.util.LinkedList |
getFigureList()
Return a list of figures managed by this instance. |
java.awt.Paint |
getFill()
Return the current fill color for drawing. |
javax.swing.AbstractAction |
getFillAction(int i)
Return the action for the given fill color |
java.awt.Font |
getFont()
Return the current font color for drawing. |
javax.swing.AbstractAction |
getFontAction(int i)
Return the action for the given font color |
DivaMainImageDisplay |
getImageDisplay()
Return the target image display. |
int |
getLineWidth()
Return the current line width for drawing. |
javax.swing.AbstractAction |
getLineWidthAction(int i)
Return the action for the given line width |
java.awt.Paint |
getOutline()
Return the current outline color for drawing. |
javax.swing.AbstractAction |
getOutlineAction(int i)
Return the action for the given outline color |
void |
hideGraphics()
Toggle the visibility all figures created by this instance. |
void |
mouseClicked(java.awt.event.MouseEvent e)
|
void |
mouseDragged(java.awt.event.MouseEvent e)
|
void |
mouseEntered(java.awt.event.MouseEvent e)
|
void |
mouseExited(java.awt.event.MouseEvent e)
|
void |
mouseMoved(java.awt.event.MouseEvent e)
|
void |
mousePressed(java.awt.event.MouseEvent e)
|
void |
mouseReleased(java.awt.event.MouseEvent e)
|
void |
removeChangeListener(javax.swing.event.ChangeListener l)
Stop receiving change events from this object. |
void |
setComposite(java.awt.Composite composite)
Set the composite (transparency). |
void |
setDrawingMode(int drawingMode)
Set the drawing mode. |
void |
setFill(java.awt.Paint fill)
Set the fill color. |
void |
setFont(java.awt.Font font)
Set the font to use for labels. |
void |
setLineWidth(int lineWidth)
Set the line width. |
void |
setOutline(java.awt.Paint outline)
Set the outline color. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected DivaMainImageDisplay imageDisplay
protected DivaImageGraphics graphics
protected javax.swing.event.EventListenerList listenerList
protected javax.swing.event.ChangeEvent changeEvent
protected boolean mouseClicked
protected int startX
protected int startY
protected diva.util.java2d.Polyline2D.Double polyline
protected diva.util.java2d.Polygon2D.Double polygon
protected diva.util.java2d.Polyline2D.Double freehand
protected diva.canvas.AbstractFigure figure
protected java.util.LinkedList figureList
public static final int SELECT
public static final int REGION
public static final int LINE
public static final int RECTANGLE
public static final int ELLIPSE
public static final int POLYLINE
public static final int POLYGON
public static final int FREEHAND
public static final int TEXT
public static final java.lang.String[] DRAWING_MODES
public static final int NUM_DRAWING_MODES
protected javax.swing.AbstractAction[] drawingModeActions
protected int drawingMode
protected boolean visible
public static final java.awt.Color[] COLORS
public static final java.lang.String[] COLOR_NAMES
public static final int NUM_COLORS
protected java.awt.Paint fill
protected java.awt.Paint outline
protected javax.swing.AbstractAction[] outlineActions
protected javax.swing.AbstractAction[] fillActions
public static final java.awt.Composite[] COMPOSITES
public static final java.lang.String[] COMPOSITE_NAMES
public static final int NUM_COMPOSITES
protected javax.swing.AbstractAction[] compositeActions
protected java.awt.Composite composite
public static final java.awt.Font[] FONTS
public static final int NUM_FONTS
protected javax.swing.AbstractAction[] fontActions
protected java.awt.Font font
public static final int[] LINE_WIDTHS
public static final int NUM_LINE_WIDTHS
protected int lineWidth
protected javax.swing.AbstractAction[] lineWidthActions
protected javax.swing.AbstractAction deleteSelectedAction
protected javax.swing.AbstractAction clearAction
protected javax.swing.AbstractAction hideGraphicsAction
Constructor Detail |
---|
public CanvasDraw(DivaMainImageDisplay imageDisplay)
imageDisplay
- used to access the JCanvas and DivaImageGraphics objectsMethod Detail |
---|
public DivaMainImageDisplay getImageDisplay()
public void setDrawingMode(int drawingMode)
drawingMode
- one of the mode constants defined in this classpublic int getDrawingMode()
public javax.swing.AbstractAction getDrawingModeAction(int drawingMode)
public void setLineWidth(int lineWidth)
public int getLineWidth()
public javax.swing.AbstractAction getLineWidthAction(int i)
public void setOutline(java.awt.Paint outline)
public java.awt.Paint getOutline()
public javax.swing.AbstractAction getOutlineAction(int i)
public void setFill(java.awt.Paint fill)
public java.awt.Paint getFill()
public javax.swing.AbstractAction getFillAction(int i)
public void setComposite(java.awt.Composite composite)
public java.awt.Composite getComposite()
public javax.swing.AbstractAction getCompositeAction(int i)
public void setFont(java.awt.Font font)
public java.awt.Font getFont()
public javax.swing.AbstractAction getFontAction(int i)
public void addChangeListener(javax.swing.event.ChangeListener l)
public void removeChangeListener(javax.swing.event.ChangeListener l)
protected void fireChange()
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked
in interface java.awt.event.MouseListener
public void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface java.awt.event.MouseListener
public void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface java.awt.event.MouseListener
public void mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface java.awt.event.MouseListener
public void mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface java.awt.event.MouseListener
public void mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface java.awt.event.MouseMotionListener
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface java.awt.event.MouseMotionListener
protected void finishFigure()
public void clear()
public void deleteSelected()
public void hideGraphics()
public java.util.LinkedList getFigureList()
public void addFigure(CanvasFigure fig)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |