|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Canvas
|
+--galapagos.DrawingCanvas
Generic Canvas descendant object for drawing lines. This object does not have any intelligence or memory. This object can have zero or more drawers who will be notified when the component refeshing is needed. This object will pass the Graphics object to the associated DrawingController objects. The notified controllers can then draw whatever they want on the passed Graphics object.
| Field Summary | |
protected int |
EMPTY
A class constant for denoting an empty list. |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
| Constructor Summary | |
DrawingCanvas()
A default constructor that creates an instance of the PlottingCanvas class. |
|
| Method Summary | |
void |
addOwner(galapagos.DrawingController owner)
A mutator method that adds another DrawingController that will draw its trajectory on this canvas. |
void |
clear()
Erases the current contents of the PlottingCanvas by painting the whole canvas with the background color. |
void |
drawPolygon(java.awt.Graphics g,
java.awt.Polygon polygon,
java.awt.Color color)
|
void |
init()
Initializes the necessary objects for double-buffering drawing. |
void |
paint(java.awt.Graphics g)
Painting of the canvas is done by drawing the whole contents using the double-buffering technique. |
void |
plot(java.awt.Graphics graphic,
java.awt.Color color,
double size,
galapagos.Position pt1,
galapagos.Position pt2)
Draws a line between two points pt1 and pt2 on the parameter graphic. |
void |
setGrid(boolean showGrid)
A mutator method that sets the flag for drawing the grid lines. |
void |
setOrigin(int x,
int y)
A mutator method that sets the origin point. |
void |
setUnit(double pixelsPerUnit)
A mutator method that sets the scaling factor. |
void |
update(java.awt.Graphics g)
Overrides the inherited update so no refreshing is done. |
| Methods inherited from class java.awt.Canvas |
addNotify |
| Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
addPropertyChangeListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
contains,
createImage,
createImage,
deliverEvent,
disable,
disableEvents,
dispatchEvent,
doLayout,
enable,
enable,
enableEvents,
enableInputMethods,
firePropertyChange,
getAlignmentX,
getAlignmentY,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentAt,
getComponentAt,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocation,
getLocationOnScreen,
getMaximumSize,
getMinimumSize,
getName,
getParent,
getPeer,
getPreferredSize,
getSize,
getSize,
getToolkit,
getTreeLock,
getWidth,
getX,
getY,
gotFocus,
handleEvent,
hasFocus,
hide,
imageUpdate,
inside,
invalidate,
isDisplayable,
isDoubleBuffered,
isEnabled,
isFocusTraversable,
isLightweight,
isOpaque,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
layout,
list,
list,
list,
list,
list,
locate,
location,
lostFocus,
minimumSize,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
paramString,
postEvent,
preferredSize,
prepareImage,
prepareImage,
print,
printAll,
processComponentEvent,
processEvent,
processFocusEvent,
processInputMethodEvent,
processKeyEvent,
processMouseEvent,
processMouseMotionEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removeNotify,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
repaint,
requestFocus,
reshape,
resize,
resize,
setBackground,
setBounds,
setBounds,
setComponentOrientation,
setCursor,
setDropTarget,
setEnabled,
setFont,
setForeground,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
setVisible,
show,
show,
size,
toString,
transferFocus,
validate |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
protected final int EMPTY
| Constructor Detail |
public DrawingCanvas()
| Method Detail |
public void addOwner(galapagos.DrawingController owner)
owner - A DrawingController that will draw its trajectory on this canvas.public void clear()
public void init()
public void drawPolygon(java.awt.Graphics g,
java.awt.Polygon polygon,
java.awt.Color color)
public void paint(java.awt.Graphics g)
graphic - A Graphics object the painting takes place.
public void plot(java.awt.Graphics graphic,
java.awt.Color color,
double size,
galapagos.Position pt1,
galapagos.Position pt2)
graphic - A Graphics object where the line is drawn.color - A color used to draw the line.size - The pen size.pt1 - The starting point of the line.pt2 - The ending point of the line.public void setGrid(boolean showGrid)
showGrid - Pass 'true' to show the grid lines.
public void setOrigin(int x,
int y)
x - The x-coordinate of a logical point that corresponds to the center
of the canvas.y - The y-coordinate of a logical point that corresponds to the center
of the canvas.public void setUnit(double pixelsPerUnit)
pixelsPerUnit - The scaling unit.public void update(java.awt.Graphics g)
g - A Graphics object where the drawing takes place.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||