|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
jview.JNormalizedCanvas
public class JNormalizedCanvas
A shape canvas is used to draw shapes into a pre-defined area. The entire
space available to this component is splitted into a frame and a drawable
area. For convenience, methods are povided to allow adding of Shapes
to the canvas which are draw in the JComponent.paint(java.awt.Graphics) method. Note that though
this method allows adding with Paint objects, the performance using
customized paints is generally much lower compared to using Colors.
In particular, it can slow down the rendering process by a factor of 100. If
you need customized strokes/ composites, try subclassing color.
| Nested Class Summary | |
|---|---|
private class |
JNormalizedCanvas.AnimateTask
This timer task does an animation using the list of valid set names provided during construction. |
static class |
JNormalizedCanvas.ShowImage
Displays an image and an otherwise empty canvas. |
static class |
JNormalizedCanvas.Test
A test class aiming for saving of the image data. |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
private JNormalizedCanvas.AnimateTask |
animate
During an animation, this will be the animation task. |
private BufferedImage |
background
A background image as displayed. |
static String |
BACKGROUNDIMAGEPROPERTY
The name of the view port image property. |
private Map<String,CanvasCursor> |
cursors
All cursor this component knows of. |
private CanvasCursor |
customcursor
If a customized cursor was set. |
private static Color |
DEFGENERICCOLOR
Default generic color, if no foreground was set. |
private static boolean |
DEFXFLIPIMAGE
Default flipping along x-axis. |
private static boolean |
DEFYFLIPIMAGE
Default flipping along y-axis. |
private Map<String,List<ShapeDraw>> |
draws
A mapping of set names vs. |
static String |
EXPORTACTION
The label on the action for saving current zoom. |
static String |
GENERIC
The name of the generic DrawInfo, composed from foreground. |
private ResourceSupplying |
info
My properties, composed from a PropertyBundles. |
protected AffineTransform |
inverse
The inverse of transform. |
static String |
KEY_BACKGROUND
The key to background color. |
static String |
KEY_CANVASNAME
If set, the name of this component. |
static String |
KEY_CANVASTIP
If set, the tool tip of this component. |
static String |
KEY_CURSORCLASSES
A tokenizable list of cursor classes to optional names. |
static String |
KEY_CURSORPROPS
A list of cursor resources. |
static String |
KEY_DRAWINGSETS
A key for a general composite object as a MyAlphaComposite. |
static String |
KEY_FOREGROUND
The key to foreground color. |
static String |
KEY_MAXIMUMHEIGHT
A key to the maximum height of this component. |
static String |
KEY_MAXIMUMWIDTH
A key to the maximum width of this component. |
static String |
KEY_MINIMUMHEIGHT
A key to the minimum height of this component. |
static String |
KEY_MINIMUMWIDTH
A key to the minimum width of this component. |
static String |
KEY_PREFERREDHEIGHT
A key to the preferred height of this component. |
static String |
KEY_PREFERREDWIDTH
A key to the preferred width of this component. |
static String |
KEY_PRINTFONT
A list of font attributes to use for printing. |
static String |
KEY_PRINTFONTSCALE
A scale for the font to use for printing. |
static String |
KEY_PRINTSHAPESCALE
A scale for the shapes to use at printing. |
static String |
KEY_RESTORESHAPES
If we want to restore saved shapes. |
static String |
KEY_XFLIPIMAGE
The flipping along the x-axis for images. |
static String |
KEY_YFLIPIMAGE
The flipping along the y-axis for images. |
private static String |
LINK
File indicator for a linking object. |
private Map<String,List<FilledShape>> |
links
A list of point-linkings. |
private Map<String,List<PointDraw>> |
points
A mapping of set names to PointDraws. |
private PostUpdate |
post
A post-update calling. |
private PreUpdate |
pre
A pre-update calling. |
static String |
PRINTACTION
The label on the action for saving current zoom. |
private double |
printscale
Used for scaling during print. |
private ImageOperation |
render
Renders the background image before displaying it. |
static String |
SAVEACTION
The label on the action for saving current zoom. |
private Map<String,DrawingInfo> |
sets
A mapping of names to DrawingInfos. |
private Map<String,List<TextDraw>> |
texts
A mapping of TextDraw objects vs. |
protected AffineTransform |
transform
The currently valid transform from normalized coordinates to screen. |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
JNormalizedCanvas(ResourceSupplying prop)
Constructs a new shape canvas with the provided property container. |
|
| Method Summary | ||
|---|---|---|
static void |
addCrossCursor(JNormalizedCanvas jtf)
Add a zoom cursor to the data canvas. |
|
int |
addDrawable(ShapeDraw shape)
Adds a shape to the drawable list of objects in the default color |
|
int |
addDrawable(String color,
Shape shape,
boolean fill)
Adds a shape to the drawable list of objects. |
|
int |
addDrawable(String color,
ShapeDraw shape)
Adds a shape to the drawable list of objects. |
|
Object |
addDrawingInfo(String stylename,
DrawingInfo color)
We allow adding of a new drawing style. |
|
List<FilledShape> |
addLink(String key,
FilledShape together)
Adds a single object to a linking with the given name. |
|
List<FilledShape> |
addLink(String key,
List<FilledShape> together)
Adds an object to a linking with the given name. |
|
int |
addPoint(PointDraw note)
Adds a text-draw object using the default color |
|
int |
addPoint(String name,
PointDraw pixel)
Adds a point-draw object specifying the name of the set. |
|
int |
addText(String name,
TextDraw note)
Adds a text-draw object specifying the name of the set. |
|
int |
addText(TextDraw note)
Adds a text-draw object using the default color |
|
protected static
|
allInside(List<T> p,
Rectangle2D norm)
Returns all Centerables that center is within the normalized box. |
|
protected static void |
applyDrawingInfo(Graphics2D g2d,
DrawingInfo how)
Applies a DrawingInfo object to a graphics2D object. |
|
protected void |
assignCursorLabel(JLabel curlab)
Assigns a label to all cursors. |
|
protected AffineTransform |
calculateShapeTransform()
Returns the affine transformation used to scale and shift shapes defined for 0,0 uper left corner and a 1x1 drawing size to the currently visible viewport and to the current size of the drawable area. |
|
void |
clearAllDrawable()
Clears all drawables. |
|
void |
clearAllText()
Clears all text entries at all colors. |
|
Object |
clearDrawable(String color)
Clears an entire list of drawables assigned to a single color. |
|
Object |
clearText(String color)
Clears all text belonging to the specified color. |
|
protected CanvasCursor |
createCanvasCursor(String curcl,
String curname,
PropertySupplying curprop)
Tries to create a customized canvas cursor from the given class name, assigning it the given cursor name, if any, using the properties handed over. |
|
protected void |
disabledCanvas(Graphics g)
Prepares the canvas for drawing the shapes. |
|
protected void |
drawPoints(Graphics2D g2d,
AffineTransform af)
Draw now all shapes. |
|
protected void |
drawPointsMap(Graphics2D g2d,
Map<String,List<PointDraw>> list,
AffineTransform af)
Paints a list of shapes onto this graphics2d object. |
|
protected void |
drawShapes(Graphics2D g2d,
AffineTransform af)
Draw now all shapes. |
|
protected void |
drawShapesMap(Graphics2D g2d,
Map<String,List<ShapeDraw>> list,
AffineTransform af)
Paints a list of shapes onto this graphics2d object. |
|
protected void |
drawText(Graphics2D g2d,
AffineTransform af)
Draw all text objects. |
|
protected void |
drawTextMap(Graphics2D g2d,
Map<String,List<TextDraw>> textmap,
AffineTransform af)
Paints a list of shapes onto this graphics2d object. |
|
void |
firePropertyChange(String s,
Object oldo,
Object newo)
We make this public. |
|
private DrawingInfo |
fromName(String name,
boolean addnew)
Scans the name for the asociated drawing sets. |
|
Map<String,Action> |
getActions()
Returns a mapping of action names to actions this component supports. |
|
protected Collection<CanvasCursor> |
getAllCanvasCursors()
For daughter classes, get all custom cursors. |
|
Collection<DrawingInfo> |
getAnimationInfo(String name)
Returns the animation-relevant drawing infos belonging to that set name. |
|
Rectangle |
getArea()
Returns the active canvas. |
|
Color |
getBackground()
Returns the background color or the default. |
|
BufferedImage |
getBackgroundImage()
Returns the background image. |
|
CanvasCursor |
getCanvasCursor()
Overrides get cursor, directly returns the cross cursor, if applicable. |
|
protected static
|
getClosest(List<T> shapes,
Point2D norm,
double maxoff)
Scans a list of shapes, calculates the bounding rectangle and returns the shape whose bounding rectangle's center has minimal distance to the normalized pixel. |
|
protected
|
getClosest(Map<String,List<T>> sets,
Point2D norm)
Returns the shape that is closed to the normalized point. |
|
protected
|
getClosest(Map<String,List<T>> sets,
Point2D norm,
double maxoff)
Returns the shape that is closed to the normalized point. |
|
|
getClosestShape(Point2D norm,
Class<T> oftype)
Locates the Centerable of the specified type that is closest to
the given normalized point. |
|
ResourceSupplying |
getComposedProperties()
Returns the ResourceSupplyings this canvas refers to. |
|
DrawingInfo |
getFromName(String name)
If we know of a DrawingInfo of the stated name, return it. |
|
protected ImageOperation |
getImageOperation()
Returns the image operation assigned to the background image. |
|
protected
|
getInside(Map<String,List<T>> set,
Rectangle2D norm)
Returns all Centerables that center is within the normalized box. |
|
|
getInsideShapes(Rectangle2D norm,
Class<T> oftype)
Returns the type of Centerables requested by forking into the
three different methods #getInsideDrawables,
#getInsidePoints, and #getInsideTexts. |
|
AffineTransform |
getInverseTransform()
Returns the affine transformation used to transform the shapes. |
|
List<FilledShape> |
getLink(String name)
Returns all linked object for the given name. |
|
List<FilledShape> |
getLinkedTo(FilledShape to)
Returns a list of all shapes that are linked together to this shape. |
|
Dimension |
getMaximumSize()
Returns a minimum size, if explicetly set in the properties or else diverts to the super method. |
|
Dimension |
getMinimumSize()
Returns a minimum size, if explicetly set in the properties or else diverts to the super method. |
|
Point2D |
getNormalized(Point screen)
Converts from screen pixels into normalized space. |
|
Rectangle2D |
getNormalizedRect(Rectangle cursor)
This method translates a selcted area on the screen into normalized coordinate space. |
|
Dimension |
getPreferredSize()
Returns the preferred size of this component. |
|
BufferedImage |
getSaveBuffer()
Returns a bufferd image showing this canvas. |
|
Point |
getScreen(Point2D norm)
Converts from normalized space into screen pixel. |
|
Rectangle |
getScreenRect(Rectangle2D cursor)
This method translates a selcted area in normalized space into screen coordinates. |
|
AffineTransform |
getShapeTransform()
Returns the affine transformation used to transform the shapes. |
|
Rectangle2D |
getViewport()
Returns the maximum active viewport. |
|
void |
init()
Initializes the shape canvas. |
|
boolean |
isEmpty()
Returns true if all drawable objects have no entries. |
|
protected boolean |
isFlipX()
Returns true, if the x-axis is flipped from its normal content. |
|
protected boolean |
isFlipY()
Returns true, if the y-axis is flipped from its normal content. |
|
boolean |
isNormalizedOnScreen(Point2D visible)
Test if this normalized pixel is related to a on-screen pixel that is within the drawable region. |
|
boolean |
isScreenInNormalized(Point cursor)
Test, if a given screen point is within the currently visible normalized coordinate space. |
|
void |
paintComponent(Graphics g)
Paint this component. |
|
protected void |
paintObjects(Graphics g,
AffineTransform af)
Draws the shapes and text. |
|
protected void |
paintPointsList(Graphics2D g2d,
List<? extends PointDraw> pixels,
AffineTransform af)
We take a list of shapes and draw/fill them using current graphics setting. |
|
protected void |
paintShapesList(Graphics2D g2d,
List<? extends ShapeDraw> shapes,
AffineTransform af)
We take a list of shapes and draw/fill them using current graphics setting. |
|
protected void |
paintTextList(Graphics2D g2d,
List<? extends TextDraw> words,
AffineTransform af)
We take a list of TextDraw objects and draw them to the graphics
supplied using the current graphics settings |
|
private boolean |
parseLine(String def)
Tries to parse a single line into a known drawable object. |
|
private boolean |
parseLink(String def)
Tries to restore linking between objects. |
|
protected void |
prepareCanvas(Graphics g)
Prepares the canvas for drawing the shapes. |
|
protected void |
printComponent(Graphics g)
Note that the graphics object we are handed over at that point is mutilated, as it is reprocessed twice in the parental method. |
|
ShapeDraw |
removeDrawable(String color,
int index)
Removes a drawable object from the list. |
|
boolean |
removeDrawable(String color,
ShapeDraw shape)
Removes a drawable object from the list. |
|
List<FilledShape> |
removeLink(String key)
Links a list of shapes together. |
|
TextDraw |
removeText(String color,
int index)
Removes a text draw object. |
|
boolean |
removeText(String color,
TextDraw note)
Removes a text draw object. |
|
void |
repaintLater()
Overrides the component repaint by putting it on the event queue, but delayed. |
|
void |
repaintNow()
Overrides the component repaint by putting it on the event queue immediately. |
|
private boolean |
restoreShapes(URL load)
Tries to restore saved shapes from a resource. |
|
private boolean |
saveShapes(File to)
Writes all the shapes/text/points found in the drawing sets to the specified file. |
|
private Dimension |
screenRelated(int w,
int h)
Returns the dimension constructed from two integer values. |
|
private static
|
searchFor(T search,
Map<String,List<T>> lookup,
StringBuffer append)
Searches an object in the specified mapping. |
|
void |
setBackgroundImage(Image img)
Sets the background image. |
|
void |
setBounds(int x,
int y,
int w,
int h)
Sets the size of the component. |
|
void |
setComplete(PostUpdate pu)
Sets a post-updateer. |
|
void |
setComposedProperties(ResourceSupplying prop)
Sets a ResourceSupplying object as a composite of the canvas. |
|
void |
setCursor(Cursor cs)
Overrides set cursor, if cursor is a cross-cursor. |
|
void |
setCursor(String name)
Sets a cursor by a known cursor name |
|
protected int |
setDrawable(String color,
List<ShapeDraw> shapes)
Exchanges an entire list. |
|
void |
setImageOperation(ImageOperation io)
Sets an image operation. |
|
List<FilledShape> |
setLink(String key,
List<FilledShape> together)
Links a list of shapes together. |
|
void |
setPrepare(PreUpdate pu)
Sets a post-updateer. |
|
void |
startAnimation(List<String> these,
long period)
Animates the canvas by cycling through the list of provided set names. |
|
void |
stopAnimation()
We stop an animation by making all the animated set visible again. |
|
protected void |
wasReshaped()
Called in this class after a reshape. |
|
private boolean |
writeLink(BufferedWriter out,
String name,
List<FilledShape> fence)
Writes a linking as object indices to the stream. |
|
private static
|
writeMap(BufferedWriter out,
ShapeFactory.Drawings style,
Map<String,List<T>> graph)
Write a mapping to a writer. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String GENERIC
DrawInfo, composed from foreground.
public static final String SAVEACTION
public static final String PRINTACTION
public static final String EXPORTACTION
public static final String BACKGROUNDIMAGEPROPERTY
public static final String KEY_CANVASNAME
public static final String KEY_CANVASTIP
public static final String KEY_PREFERREDWIDTH
public static final String KEY_PREFERREDHEIGHT
public static final String KEY_MINIMUMWIDTH
public static final String KEY_MINIMUMHEIGHT
public static final String KEY_MAXIMUMWIDTH
public static final String KEY_MAXIMUMHEIGHT
public static final String KEY_FOREGROUND
public static final String KEY_BACKGROUND
public static final String KEY_DRAWINGSETS
MyAlphaComposite.
public static final String KEY_XFLIPIMAGE
public static final String KEY_YFLIPIMAGE
public static final String KEY_RESTORESHAPES
public static final String KEY_CURSORCLASSES
public static final String KEY_CURSORPROPS
public static final String KEY_PRINTFONT
public static final String KEY_PRINTFONTSCALE
public static final String KEY_PRINTSHAPESCALE
private static final String LINK
private static final Color DEFGENERICCOLOR
private static final boolean DEFXFLIPIMAGE
private static final boolean DEFYFLIPIMAGE
private ResourceSupplying info
PropertyBundles.
private Map<String,CanvasCursor> cursors
private Map<String,DrawingInfo> sets
DrawingInfos.
private Map<String,List<PointDraw>> points
PointDraws.
private Map<String,List<ShapeDraw>> draws
private Map<String,List<TextDraw>> texts
TextDraw objects vs. their DrawingInfos.
private Map<String,List<FilledShape>> links
protected AffineTransform transform
protected AffineTransform inverse
transform.
private BufferedImage background
private CanvasCursor customcursor
private ImageOperation render
private PreUpdate pre
private PostUpdate post
private double printscale
private JNormalizedCanvas.AnimateTask animate
| Constructor Detail |
|---|
public JNormalizedCanvas(ResourceSupplying prop)
| Method Detail |
|---|
public void firePropertyChange(String s,
Object oldo,
Object newo)
firePropertyChange in class Componentpublic void setComposedProperties(ResourceSupplying prop)
ResourceSupplying object as a composite of the canvas.
Defaults the necessary parameter.
setComposedProperties in interface ResourceAwarepublic void init()
init in interface Initializable
protected CanvasCursor createCanvasCursor(String curcl,
String curname,
PropertySupplying curprop)
#setCanvasCursor.
protected void assignCursorLabel(JLabel curlab)
private boolean restoreShapes(URL load)
#Drawing, and must be followed by a StringTool.DOLLAR
separator.StringTool.DOLLAR. Drawing set must be defined in
KEY_DRAWINGSETS.Shapes are constructed with the
ShapeFactory.createShape(java.lang.String) method, TextDraw and
PointDraw objects are constructed with the remainder of the line
passed to the constructor.saveShapes(java.io.File).
private boolean parseLink(String def)
throws ParseException
LINK '$' Name-of-link '$' double tokenized List:
ShapeFactory.Drawings,set name, index;...
ParseException
private boolean parseLine(String def)
throws ParseException
ShapeFactory.Drawings '$' set name '$' drawig-pattern '$'(true|false).The last part is true for filled objects.
ParseExceptionprivate boolean saveShapes(File to)
private boolean writeLink(BufferedWriter out,
String name,
List<FilledShape> fence)
throws IOException
IOException
private static <T> boolean searchFor(T search,
Map<String,List<T>> lookup,
StringBuffer append)
private static <T> boolean writeMap(BufferedWriter out,
ShapeFactory.Drawings style,
Map<String,List<T>> graph)
throws IOException
IOExceptionpublic void setCursor(String name)
public void setCursor(Cursor cs)
setCursor in class Componentpublic CanvasCursor getCanvasCursor()
getAllCanvasCursors()protected Collection<CanvasCursor> getAllCanvasCursors()
public Object addDrawingInfo(String stylename,
DrawingInfo color)
public ResourceSupplying getComposedProperties()
ResourceSupplyings this canvas refers to.
getComposedProperties in interface ResourceComposedpublic void repaintLater()
public void repaintNow()
throws InterruptedException
InterruptedException
public void startAnimation(List<String> these,
long period)
public void stopAnimation()
public Color getBackground()
getBackground in class Componentpublic void setPrepare(PreUpdate pu)
public void setComplete(PostUpdate pu)
public void setImageOperation(ImageOperation io)
protected ImageOperation getImageOperation()
public void setBackgroundImage(Image img)
public BufferedImage getBackgroundImage()
public Dimension getPreferredSize()
getPreferredSize in class JComponentpublic Dimension getMinimumSize()
getMinimumSize in class JComponentpublic Dimension getMaximumSize()
getMaximumSize in class JComponent
public void setBounds(int x,
int y,
int w,
int h)
setBounds in class Componentprotected void wasReshaped()
public boolean isEmpty()
public AffineTransform getShapeTransform()
public AffineTransform getInverseTransform()
protected AffineTransform calculateShapeTransform()
private DrawingInfo fromName(String name,
boolean addnew)
addnew is true, a new Drawing set is generated
from the name.
public int addPoint(PointDraw note)
public int addPoint(String name,
PointDraw pixel)
public int addText(TextDraw note)
public int addText(String name,
TextDraw note)
public Object clearText(String color)
public void clearAllText()
public TextDraw removeText(String color,
int index)
public boolean removeText(String color,
TextDraw note)
public int addDrawable(ShapeDraw shape)
public int addDrawable(String color,
Shape shape,
boolean fill)
public int addDrawable(String color,
ShapeDraw shape)
public List<FilledShape> removeLink(String key)
public List<FilledShape> setLink(String key,
List<FilledShape> together)
public List<FilledShape> addLink(String key,
FilledShape together)
public List<FilledShape> addLink(String key,
List<FilledShape> together)
public List<FilledShape> getLink(String name)
public List<FilledShape> getLinkedTo(FilledShape to)
public <T extends Centerable> Collection<T> getInsideShapes(Rectangle2D norm,
Class<T> oftype)
Centerables requested by forking into the
three different methods #getInsideDrawables,
#getInsidePoints, and #getInsideTexts. If neither of the
types applies, null is returned.
getInsideShapes in interface NormalizedShapesnorm - The bounding rectangle in normalized coordinates.
protected <T extends Centerable> List<T> getInside(Map<String,List<T>> set,
Rectangle2D norm)
Centerables that center is within the normalized box.
protected static <T extends Centerable> List<T> allInside(List<T> p,
Rectangle2D norm)
Centerables that center is within the normalized box.
public <T extends Centerable> T getClosestShape(Point2D norm,
Class<T> oftype)
Centerable of the specified type that is closest to
the given normalized point. Forks into the three different methods
#getClosestDrawable, #getClosestPoint, and
#getClosestText. If neither of the types applies, null is
returned.
getClosestShape in interface NormalizedShapesnorm - The point-of-interest in normalized coordinates.
protected <T extends Centerable> T getClosest(Map<String,List<T>> sets,
Point2D norm)
protected <T extends Centerable> T getClosest(Map<String,List<T>> sets,
Point2D norm,
double maxoff)
protected static <T extends Centerable> T getClosest(List<T> shapes,
Point2D norm,
double maxoff)
protected int setDrawable(String color,
List<ShapeDraw> shapes)
public Object clearDrawable(String color)
public void clearAllDrawable()
public ShapeDraw removeDrawable(String color,
int index)
public boolean removeDrawable(String color,
ShapeDraw shape)
public Point2D getNormalized(Point screen)
Point object, while the return value is a
Point2D object.
getNormalized in interface NormalizedCoordinatesscreen - A point on the screen.
protected boolean isFlipX()
KEY_XFLIPIMAGE property is true.
protected boolean isFlipY()
KEY_YFLIPIMAGE property is true.
public Rectangle2D getNormalizedRect(Rectangle cursor)
getNormalizedRect in interface NormalizedCoordinatescursor - A rectangle on the screen.
public Point getScreen(Point2D norm)
Point2D object, while the return value is a pure
Point object.
getScreen in interface NormalizedCoordinatesnorm - A point in normalized space
public Rectangle getScreenRect(Rectangle2D cursor)
getScreenRect in interface NormalizedCoordinatescursor - A rectangle in normalized coordinate space.
public Rectangle getArea()
getArea in interface NormalizedCoordinatesZoomablepublic boolean isScreenInNormalized(Point cursor)
isScreenInNormalized in interface NormalizedCoordinatescursor - A point on the screen.public boolean isNormalizedOnScreen(Point2D visible)
isNormalizedOnScreen in interface NormalizedCoordinatesvisible - A point in normalized space, 0≤x,y&le1.public Rectangle2D getViewport()
getViewport in interface NormalizedCoordinatesZoomablepublic DrawingInfo getFromName(String name)
DrawingInfo of the stated name, return it.
public Collection<DrawingInfo> getAnimationInfo(String name)
public BufferedImage getSaveBuffer()
getSaveBuffer in interface Savablepublic Map<String,Action> getActions()
JComponent.getActionMap(), but should be
used by the application to further process it before adding it to the
action map and input map of the component.
public static void addCrossCursor(JNormalizedCanvas jtf)
protected void printComponent(Graphics g)
printComponent in class JComponentpublic void paintComponent(Graphics g)
paintComponent in class JComponent
protected void paintObjects(Graphics g,
AffineTransform af)
protected void drawPoints(Graphics2D g2d,
AffineTransform af)
Changing drawing attributes here is okay, they will be reset later.
protected void drawShapes(Graphics2D g2d,
AffineTransform af)
Changing drawing attributes here is okay, they will be reset later.
protected void drawText(Graphics2D g2d,
AffineTransform af)
protected void drawTextMap(Graphics2D g2d,
Map<String,List<TextDraw>> textmap,
AffineTransform af)
Composite, the Stroke, or the
Paint interface, we set these attributes prior to drawing.
g - The graphics object to draw on.list - A List of Shapes. May not be null.outline - If true, we only draw instead of filling.protected void prepareCanvas(Graphics g)
protected void disabledCanvas(Graphics g)
protected void drawShapesMap(Graphics2D g2d,
Map<String,List<ShapeDraw>> list,
AffineTransform af)
Composite, the Stroke, or the
Paint interface, we set these attributes prior to drawing.
g - The graphics object to draw on.list - A List of Shapes. May not be null.outline - If true, we only draw instead of filling.
protected void drawPointsMap(Graphics2D g2d,
Map<String,List<PointDraw>> list,
AffineTransform af)
Composite, the Stroke, or the
Paint interface, we set these attributes prior to drawing.
g - The graphics object to draw on.list - A List of Shapes. May not be null.outline - If true, we only draw instead of filling.
protected void paintPointsList(Graphics2D g2d,
List<? extends PointDraw> pixels,
AffineTransform af)
protected void paintShapesList(Graphics2D g2d,
List<? extends ShapeDraw> shapes,
AffineTransform af)
protected void paintTextList(Graphics2D g2d,
List<? extends TextDraw> words,
AffineTransform af)
TextDraw objects and draw them to the graphics
supplied using the current graphics settings
protected static void applyDrawingInfo(Graphics2D g2d,
DrawingInfo how)
DrawingInfo object to a graphics2D object. The old info
is destroyed and must be cached outside this method if needed.
private Dimension screenRelated(int w,
int h)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||