|
|||||||
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 | +--ShapeCanvas
ShapeCanvas class This class represents a canvas that can display colored shapes and let the user drag them around. It uses an off-screen images to make the dragging look as smooth as possible.
Update History -------------- Date By Description ---- -- ----------- 11/10/00 Asha Mony Creation
Inner classes inherited from class java.awt.Component |
java.awt.Component.AWTTreeLock |
Field Summary | |
(package private) java.awt.Color |
currentColor
|
(package private) java.awt.Image |
offScreenCanvas
|
(package private) java.awt.Graphics |
offScreenGraphics
|
(package private) int |
prevDragX
|
(package private) int |
prevDragY
|
(package private) Shape |
shapeBeingDragged
|
(package private) java.util.Vector |
shapes
|
Fields inherited from class java.awt.Canvas |
base,
graphicsConfig,
nameCounter,
serialVersionUID |
Fields inherited from class java.awt.Component |
actionListenerK,
adjustmentListenerK,
appContext,
assert,
background,
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
changeSupport,
componentListener,
componentListenerK,
componentOrientation,
componentSerializedDataVersion,
containerListenerK,
cursor,
dropTarget,
enabled,
eventMask,
focusListener,
focusListenerK,
font,
foreground,
hasFocus,
height,
incRate,
inputMethodListener,
inputMethodListenerK,
isInc,
isPacked,
itemListenerK,
keyListener,
keyListenerK,
LEFT_ALIGNMENT,
locale,
LOCK,
minSize,
mouseListener,
mouseListenerK,
mouseMotionListener,
mouseMotionListenerK,
name,
nameExplicitlySet,
newEventsOnly,
ownedWindowK,
parent,
peer,
peerFont,
popups,
prefSize,
RIGHT_ALIGNMENT,
serialVersionUID,
textListenerK,
TOP_ALIGNMENT,
valid,
visible,
width,
windowListenerK,
x,
y |
Constructor Summary | |
(package private) |
ShapeCanvas()
|
Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent evt)
Called to respond to action events. |
(package private) void |
addShape(Shape shape)
|
void |
itemStateChanged(java.awt.event.ItemEvent evt)
This is called to respond to item events. |
(package private) void |
makeOffScreenCanvas()
|
void |
mouseClicked(java.awt.event.MouseEvent evt)
|
void |
mouseDragged(java.awt.event.MouseEvent evt)
User has moved the mouse. |
void |
mouseEntered(java.awt.event.MouseEvent evt)
|
void |
mouseExited(java.awt.event.MouseEvent evt)
|
void |
mouseMoved(java.awt.event.MouseEvent evt)
|
void |
mousePressed(java.awt.event.MouseEvent evt)
User has pressed the mouse. |
void |
mouseReleased(java.awt.event.MouseEvent evt)
User has released the mouse. |
void |
paint(java.awt.Graphics g)
In the paint method, everything is drawn to an off-screen canvas, and then that canvas is copied onto the screen. |
void |
update(java.awt.Graphics g)
Update method is called when canvas is to be redrawn. |
Methods inherited from class java.awt.Canvas |
|
Methods inherited from class java.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
addPropertyChangeListener,
addPropertyChangeListener,
areInputMethodsEnabled,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
contains,
createImage,
createImage,
deliverEvent,
disable,
disableEvents,
dispatchEvent,
dispatchEventImpl,
doLayout,
enable,
enable,
enableEvents,
enableInputMethods,
eventEnabled,
firePropertyChange,
getAlignmentX,
getAlignmentY,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentAt,
getComponentAt,
getComponentOrientation,
getCursor,
getDropTarget,
getFont_NoClientCode,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getInputContext,
getInputMethodRequests,
getIntrinsicCursor,
getLocale,
getLocation,
getLocation,
getLocationOnScreen,
getMaximumSize,
getMinimumSize,
getName,
getNativeContainer,
getParent_NoClientCode,
getParent,
getPeer,
getPreferredSize,
getSize,
getSize,
getToolkit,
getToolkitImpl,
getTreeLock,
getWidth,
getWindowForObject,
getX,
getY,
gotFocus,
handleEvent,
hasFocus,
hide,
imageUpdate,
initIDs,
inside,
invalidate,
isDisplayable,
isDoubleBuffered,
isEnabled,
isEnabledImpl,
isFocusTraversable,
isLightweight,
isOpaque,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
layout,
lightweightPrint,
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,
printHeavyweightComponents,
processComponentEvent,
processEvent,
processFocusEvent,
processInputMethodEvent,
processKeyEvent,
processMouseEvent,
processMouseMotionEvent,
readObject,
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,
writeObject |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
Field Detail |
java.awt.Image offScreenCanvas
java.awt.Graphics offScreenGraphics
java.util.Vector shapes
java.awt.Color currentColor
Shape shapeBeingDragged
int prevDragX
int prevDragY
Constructor Detail |
ShapeCanvas()
Method Detail |
public void paint(java.awt.Graphics g)
Update History -------------- Date By Description ---- -- ----------- 11/10/00 Asha Mony Creation
public void update(java.awt.Graphics g)
Update History -------------- Date By Description ---- -- ----------- 11/10/00 Asha Mony Creation
void makeOffScreenCanvas()
public void itemStateChanged(java.awt.event.ItemEvent evt)
Update History -------------- Date By Description ---- -- ----------- 11/10/00 Asha Mony Creation
public void actionPerformed(java.awt.event.ActionEvent evt)
Update History -------------- Date By Description ---- -- ----------- 11/10/00 Asha Mony Creation
void addShape(Shape shape)
public void mousePressed(java.awt.event.MouseEvent evt)
Update History -------------- Date By Description ---- -- ----------- 11/10/00 Asha Mony Creation
public void mouseDragged(java.awt.event.MouseEvent evt)
Update History -------------- Date By Description ---- -- ----------- 11/10/00 Asha Mony Creation
public void mouseReleased(java.awt.event.MouseEvent evt)
Update History -------------- Date By Description ---- -- ----------- 11/10/00 Asha Mony Creation
public void mouseEntered(java.awt.event.MouseEvent evt)
public void mouseExited(java.awt.event.MouseEvent evt)
public void mouseMoved(java.awt.event.MouseEvent evt)
public void mouseClicked(java.awt.event.MouseEvent evt)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |