See: Description
Interface | Description |
---|---|
Draw |
DrawActions interface for a Diva canvas. |
DrawFigure |
DrawFigure defines an interface that any Figures drawn on a
Draw implementation should implement. |
FigureListener |
FigureListener defines an interface used when listening for the
creation, removal and changes of Figures on a
Draw instance. |
FigureStore |
Interface providing access to a facility for storing and restoring
XML descriptions of
DrawFigures that are displayed on a
DrawGraphicsPane by a DrawActions instance. |
Class | Description |
---|---|
DragRegion |
A class that implements rubber-banding on a canvas.
|
DrawActions |
This class defines a set of objects (created as AbstractActions)
for drawing on a JCanvas that implements the Draw interface.
|
DrawBasicFigure |
DrawBasicFigure extends the diva BasicFigure class to add support for
events that allow users of any derived figures to be made aware of
any changes -- figure creation, removal and transformations.
|
DrawCompositeFigure |
DrawCompositeFigure extends the Diva BackgroundedCompositeFigure
class to add support for events that allow users of any derived
figures to be made aware of any changes, i.e. composite figure
creation, removal and transformations.
|
DrawController |
A basic controller implementation.
|
DrawEllipseFigure |
A figure that displays as an ellipse.
|
DrawFigureFactory |
This class creates and enumerates the possible instance of Figures
that can be created on an instance of
Draw for use with a
DrawActions instance. |
DrawFigureStore |
Implementation of a
StoreSource as a FigureStore to save
and restore figures from an application specific backing store file using
a StoreControlFrame . |
DrawFreehandFigure |
A figure that displays a polyline that can have its vertices moved,
intended for use as a freehand (i.e. many vertices) figure, same as
Polyline figure but can be identified as needing different treatment.
|
DrawGraphicsMenu |
A menu with graphics related actions from a
DrawActions instance
for drawing and manipulating figures on a Draw implementation. |
DrawGraphicsPane |
The pane for displaying any interactive graphic Figures associated
with a
Draw . |
DrawLabelFigure |
Implementation of a LabelFigure for use with a
Draw
implementation. |
DrawLineFigure |
A figure that displays as a line.
|
DrawPathFigure |
DrawPathFigure extends the diva PathFigure class to add support for
events that allow users of any derived figures to be made aware of
any changes, i.e. figure creation, removal and transformations.
|
DrawPolygonFigure |
A figure that displays a polyline that can have its vertices moved.
|
DrawPolylineFigure |
A figure that displays a polyline that can have its vertices moved.
|
DrawRectangleFigure |
A figure that displays as a rectangle.
|
FigureChangedEvent |
FigureChangedEvent defines an event that describes a change to a
figure drawn on a
Draw instance. |
FigureProps |
A container class for storing the configuration properties of Figures
created by
DrawFigureFactory . |
InterpolatedCurveFigure |
A figure that displays a InterpolatedCurve that can have its
vertices moved.
|
InterpolatedCurveManipulator |
A manipulator for InterpolatedCurveFigure figures.
|
RangeManipulator |
A manipulator which attaches grab handles to the vertical or
horizontal bounds of a figure.
|
TestDrawActions | |
XRangeFigure |
A figure that displays a optionally fixed height rectangle that can
only be moved side to side, or a plain rectangle.
|
Provides a toolkit for creating and interacting with simple Figures and also a methodology for connecting to the life cycle of those Figures. I.e. getting notification of their creation, modification and destruction.
The only general access method is to use the DrawGraphicsMenu
class to add a menu to a JMenuBar that provides actions to
create and configure Figures.
An simple example using this can be found in the TestDrawActions class displayed here:
import diva.canvas.JCanvas
; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JMenuBar; public class TestDrawActions extendsJCanvas
implementsDraw
{ protectedDrawGraphicsPane
graphicsPane = null; public TestDrawActions() { // Add a DrawGraphicsPane to use for displaying // interactive graphics elements. graphicsPane = newDrawGraphicsPane
(DrawActions.getTypedDecorator()
); setCanvasPane( graphicsPane ); } publicDrawGraphicsPane
getGraphicsPane() { return graphicsPane; } public Component getComponent() { return this; } public static void main( String[] args ) { TestDrawActions canvas = new TestDrawActions();DrawActions
drawActions = newDrawActions
( canvas ); JFrame frame = new JFrame( "TestDrawActions" ); frame.setSize( new Dimension( 200, 200 ) ); frame.getContentPane().setLayout( new BorderLayout() ); frame.getContentPane().add( canvas, BorderLayout.CENTER ); JMenuBar menuBar = new JMenuBar(); frame.setJMenuBar( menuBar ); menuBar.add( newDrawGraphicsMenu
( drawActions ) ); frame.setVisible( true ); } }
The important points are that you should use the toolkit to draw on an
JCanvas that implements Draw
and
that has its CanvasPane set to an instance of
DrawGraphicsPane
.
The toolkit itself is made available by adding an instance of
DrawActions
to an instance of
DrawGraphicsMenu
.
DrawGraphicsMenu is a JMenu so can be added to JMenuBar as shown.
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.