![]() | [using it] | Interface Manipulation Package v4.0 (2008-06-25) | ![]() | ©copyright | ![]() |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
imp.gui.IComponent
imp.gui.GraphicsViewer
public class GraphicsViewer
Defines a panel in which 2D graphics is displayed.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.BaselineResizeBehavior |
Field Summary |
---|
Fields inherited from class javax.swing.JComponent |
---|
TOOL_TIP_TEXT_KEY, 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 |
Method Summary | |
---|---|
GraphicsViewer |
add(int depth,
Value component)
Adds a XML graphical element and return this. |
JComponent |
addImage(int depth,
int x,
int y,
BufferedImage image)
Adds an image or icon to this canvas. |
JComponent |
addLabel(int depth,
int x,
int y,
String text)
Adds a textual label to this canvas. |
Polyline |
addPolyline(int depth,
Polygon polygon,
boolean closed,
String bgcolor,
String color)
Adds a polyline to this canvas. |
JComponent |
get(int index)
Gets the component of the given index. |
String |
getInteraction()
Gets the interaction mode. |
void |
outputValue(String value)
Called when a mouse interaction is output. |
void |
remove(JComponent component)
Remove a component. |
void |
removeAll()
Removes all components. |
GraphicsViewer |
setInteraction(String interaction)
Sets the interaction mode and return this. |
Methods inherited from class imp.gui.IComponent |
---|
getBgcolor, getColor, getTextFont, getTitle, getTooltip, grab, refresh, setBgcolor, setColor, setHeight, setTextFont, setTitle, setTooltip, setWidth |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public GraphicsViewer add(int depth, Value component)
depth
- [optional, default is -1] Element depth, acts as an index.
A value of -1 indicates the bottommost position. A value of 0 indicates the topmost position: higher position values are lower in the display.component
- An element defined by a set of field's value. icon | <icon x= .. y= .. d= .. icon = {icon-URL}/> |
label | <label x= .. y= .. d= .. text = {text-in-HTML-format}/> |
polygon | <polygon x-a={1st-horizontal-position} y-a={1st-vertical-position} x-b={2nd-..}.. d= .. closed={true-or-false} color/bgcolor= .. /> |
cross | <cross x= .. y= .. d= .. form= .. size= .. color= .. /> |
rectangle (also called square) | <rectangle x= .. y= .. d= .. width= .. height= .. color/bgcolor= .. /> |
line (also called arrow) | <line x-a= .. x-b= .. y-a= .. y-b= .. arrow = {true-or-false} color= .. /> |
line (also called arrow) | <line x= .. y= .. d= .. size= .. orientation= .. arrow = {true-or-false} color= .. /> |
oval (also called circle) | <oval x= .. y= .. d= .. width= .. height= .. orientation= .. rectangularity={0.1 .. 10} color/bgcolor= .. /> |
ellipse | <ellipse x= .. y= .. d= .. Ixx={2nd-order-xx-momentum} Ixy={2nd-order-xy-momentum} Iyy={2nd-order-yy-momentum} color/bgcolor= .. /> |
public JComponent addImage(int depth, int x, int y, BufferedImage image)
depth
- [optional, default is -1] Element depth, acts as an index.
A value of -1 indicates the bottommost position. A value of 0 indicates the topmost position: higher position values are lower in the display.x
- [optional, default is position the image in the upper-left corner] Image horizontal central position.y
- [optional, default is position the image in the upper-left corner] Image vertical central position.image
- The image to show. public JComponent addLabel(int depth, int x, int y, String text)
depth
- [optional, default is -1] Element depth, acts as an index.
A value of -1 indicates the bottommost position. A value of 0 indicates the topmost position: higher position values are lower in the display.x
- Label horizontal central position.y
- Label vertical central position.text
- The label text.
public Polyline addPolyline(int depth, Polygon polygon, boolean closed, String bgcolor, String color)
depth
- [optional, default is -1] Element depth, acts as an index.
A value of -1 indicates the bottommost position. A value of 0 indicates the topmost position: higher position values are lower in the display.polygon
- Points defining this polyline (see the Polyline factory for predefined polygons: points, lines, ellipses, ..).closed
- [optional, default is false] True if the polyline is closed (thus a geometric polygon), false if an open polyline.bgcolor
- [optional, default is null] Polygon fill color, if any (i.e if not null).color
- Polyline border color, if any (else null).
public JComponent get(int index)
index
- The component index.
public String getInteraction()
public void outputValue(String value)
value
- The mouse interaction value.public void remove(JComponent component)
public void removeAll()
removeAll
in class Container
public GraphicsViewer setInteraction(String interaction)
interaction
- The mouse interaction.