|
||||||||||
| 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
jview.JViewportCanvas
jview.JFrameCanvas
public class JFrameCanvas
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. It allows saving of the component as an image file using the JDK's 1.4
javax.imageio.ImageIO package. For convenience, methods are povided
to allow adding of Shapes to the canvas which are draw in the
JComponent.paint(java.awt.Graphics) method.
| Nested Class Summary | |
|---|---|
static class |
JFrameCanvas.Test
A test class aiming for saving of the image data. |
| Nested classes/interfaces inherited from class jview.JViewportCanvas |
|---|
JViewportCanvas.ViewportKey |
| Nested classes/interfaces inherited from class jview.JNormalizedCanvas |
|---|
JNormalizedCanvas.ShowImage |
| 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 Rectangle |
activecanvas
The drawable size of this component. |
private static int |
DEFABSOLUTEHEIGHT
The default height absoulte. |
private static int |
DEFABSOLUTEWIDTH
The default width absoulte. |
private static double |
DEFRELATIVEHEIGHT
The default heightt relative. |
private static double |
DEFRELATIVEWIDTH
The default width relative. |
private static String |
DEFTITLEJUSTIFY
The default title justification, center, center, bottom. |
private static int |
DEFTITLEOFFSET
The default title offset above the upper horizontal. |
private static int |
DEFTOPOFFSET
The default yop offset above the upper horizontal. |
private static String |
DEFTOPSEPARATOR
The default separator char in top texts. |
private static int |
DEFXFRAME
The default x-inset absoulte. |
private static int |
DEFXINSETABSOLUTE
The default x-inset absoulte. |
private static double |
DEFXINSETRELATIVE
The default x-inset relative. |
private static int |
DEFYFRAME
The default y-inset absoulte. |
private static int |
DEFYINSETABSOLUTE
The default y-inset absoulte. |
private static double |
DEFYINSETRELATIVE
The default y-inset relative. |
static String |
KEY_ABSOLUTEHEIGHT
The key to the draw size height, absolute pixel values. |
static String |
KEY_ABSOLUTEWIDTH
The key to the draw size width, absolute pixel values. |
static String |
KEY_DRAWBOX
If true, we add a box around the drawable area in foreground color. |
static String |
KEY_RELATIVEHEIGHT
The key to the draw size height, relative to size. |
static String |
KEY_RELATIVEWIDTH
The key to the draw size width, relative to size. |
static String |
KEY_TITLECOLOR
The main title color. |
static String |
KEY_TITLEFONT
The title font. |
static String |
KEY_TITLEJUSTIFY
The title justification. |
static String |
KEY_TITLEOFFSET
The y-tile distance to the upper box horizontal. |
static String |
KEY_TITLETEXT
The main title. |
static String |
KEY_TOPCOLOR
The main title color. |
static String |
KEY_TOPFONT
The title font. |
static String |
KEY_TOPJUSTIFY
The title justification. |
static String |
KEY_TOPOFFSET
The y-tile distance to the upper box horizontal. |
static String |
KEY_TOPSEPARATOR
The separator char in top texts and topjustifications. |
static String |
KEY_TOPTEXT
Additional texts at different justifications. |
static String |
KEY_XFRAME
The key to the allowed border overdraw in pixel values. |
static String |
KEY_XINSETABSOLUTE
The key to the top-left x-inset, absoulte pixel values. |
static String |
KEY_XINSETRELATIVE
The key to the top-left x-inset, relative value to size. |
static String |
KEY_YFRAME
The key to the allowed border-overdraw in pixel values. |
static String |
KEY_YINSETABSOLUTE
The key to the top-left y-inset, absoulte pixel values. |
static String |
KEY_YINSETRELATIVE
The key to the top-left y-inset, relative value to size. |
| Fields inherited from class jview.JViewportCanvas |
|---|
MAXVIEW, VIEWPORTIMAGEPROPERTY, VIEWPORTPROPERTY |
| 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 | |
|---|---|
JFrameCanvas(ResourceSupplying prop)
Constructs a new shape canvas with the provided property container. |
|
| Method Summary | |
|---|---|
protected Rectangle |
calculateActiveCanvas()
Calculates the current drawable size of this component after a resize event. |
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. |
Rectangle |
getArea()
Returns the active canvas. |
private double |
getJustification(char j,
double def)
Converts a justification char into a justification double. |
private Point2D |
getTitleInset(FontMetrics fm,
int width,
String text,
String just)
Returns the title offset from the upper left corner of the active area. |
private Point2D |
getTopInset(FontMetrics fm,
int width,
String text,
String just)
Returns the top offset from the upper left corner of the active area. |
void |
init()
Initializes the shape canvas. |
boolean |
isScreenInNormalized(Point cursor)
Test, if a given screen point is within the currently visible normalized coordinate space. |
protected void |
paintObjects(Graphics g,
AffineTransform af)
Paint this component. |
protected void |
prepareCanvas(Graphics g)
Prepares the canvas for drawing the shapes. |
void |
setComposedProperties(ResourceSupplying prop)
Sets a ResourceSupplying object as a composite of the canvas. |
protected void |
wasReshaped()
Called in this class after a reshape. |
| Methods inherited from class jview.JViewportCanvas |
|---|
addAttachedViewport, addZoom, getViewport, getViewportImage, isMaximalViewport, isNormalizedOnScreen, removeAttachedViewport, resetViewport, selectArea, selectViewport, setViewportImage, silentlySelectViewport, transferView |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String KEY_XINSETABSOLUTE
public static final String KEY_YINSETABSOLUTE
public static final String KEY_XINSETRELATIVE
public static final String KEY_YINSETRELATIVE
public static final String KEY_XFRAME
public static final String KEY_YFRAME
public static final String KEY_ABSOLUTEWIDTH
public static final String KEY_ABSOLUTEHEIGHT
public static final String KEY_RELATIVEWIDTH
public static final String KEY_RELATIVEHEIGHT
public static final String KEY_DRAWBOX
public static final String KEY_TITLETEXT
public static final String KEY_TITLECOLOR
public static final String KEY_TITLEFONT
public static final String KEY_TITLEJUSTIFY
public static final String KEY_TITLEOFFSET
public static final String KEY_TOPTEXT
public static final String KEY_TOPCOLOR
public static final String KEY_TOPFONT
public static final String KEY_TOPJUSTIFY
public static final String KEY_TOPOFFSET
public static final String KEY_TOPSEPARATOR
private static final int DEFXINSETABSOLUTE
private static final int DEFYINSETABSOLUTE
private static final double DEFXINSETRELATIVE
private static final double DEFYINSETRELATIVE
private static final int DEFXFRAME
private static final int DEFYFRAME
private static final int DEFABSOLUTEWIDTH
private static final int DEFABSOLUTEHEIGHT
private static final double DEFRELATIVEWIDTH
private static final double DEFRELATIVEHEIGHT
private static final String DEFTITLEJUSTIFY
private static final int DEFTITLEOFFSET
private static final int DEFTOPOFFSET
private static final String DEFTOPSEPARATOR
private Rectangle activecanvas
| Constructor Detail |
|---|
public JFrameCanvas(ResourceSupplying prop)
| Method Detail |
|---|
public void setComposedProperties(ResourceSupplying prop)
ResourceSupplying object as a composite of the canvas.
Defaults the necessary parameter.
setComposedProperties in interface ResourceAwaresetComposedProperties in class JNormalizedCanvaspublic void init()
init in interface Initializableinit in class JViewportCanvasprotected Rectangle calculateActiveCanvas()
protected void wasReshaped()
wasReshaped in class JNormalizedCanvasprotected AffineTransform calculateShapeTransform()
calculateShapeTransform in class JViewportCanvaspublic boolean isScreenInNormalized(Point cursor)
isScreenInNormalized in interface NormalizedCoordinatesisScreenInNormalized in class JNormalizedCanvascursor - A point on the screen.public Rectangle getArea()
getArea in interface NormalizedCoordinatesgetArea in class JNormalizedCanvasZoomable
protected void paintObjects(Graphics g,
AffineTransform af)
paintObjects in class JNormalizedCanvasprotected void prepareCanvas(Graphics g)
prepareCanvas in class JViewportCanvas
private Point2D getTitleInset(FontMetrics fm,
int width,
String text,
String just)
private Point2D getTopInset(FontMetrics fm,
int width,
String text,
String just)
private double getJustification(char j,
double def)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||