|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
java.applet.Applet
maclib.DrawingApplet
public class DrawingApplet
A DrawingApplet is used for a drawing panel and it is associated
with a DrawingStuff object that provides automatic repaint, using
an off-screen image.
The DrawingStuff also implements listeners for handling keyboard
and mouse events that concern the DrawingApplet.
A subclass of DrawingApplet may be instanciated directly as an
applet.
In this case, a GrafPort object is also allocated and it provides an
interface for QuickDraw-like drawing and event routines.
This GrafPort is available by a call to the getPort()
method.
Any subclass of DrawingApplet that overrides the
init(), destroy() or paint(Graphics)
methods, should call these in turn to provides suitable working.
The start() method does nothing and any subclass of
DrawingApplet should override it.
A DrawingApplet object is also instanciated during the explicit
initialization of a GrafPort.
In that case the DrawingApplet is set as the component of a
DrawingFrame and it doesn't need direct control.
DrawingStuff,
GrafPort,
DrawingFrame,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.BaselineResizeBehavior |
| Field Summary |
|---|
| 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 | |
|---|---|
DrawingApplet()
The default constructor for a DrawingApplet used as an applet. |
|
| Method Summary | |
|---|---|
void |
componentHidden(java.awt.event.ComponentEvent e)
Invoked when the panel has been hidden. |
void |
componentMoved(java.awt.event.ComponentEvent e)
Invoked when the panel has been moved. |
void |
componentResized(java.awt.event.ComponentEvent e)
Invoked when the panel has been resized. |
void |
componentShown(java.awt.event.ComponentEvent e)
Invoked when the panel has been made visible. |
void |
destroy()
The destroy method as for any applet. |
void |
dispose()
Disposes of this DrawingApplet. |
void |
finalize()
Called by the garbage collector when there are no more reference to this DrawingApplet. |
java.lang.String |
getAppletInfo()
Returns a string giving informations about this DrawingApplet. |
GrafPort |
getPort()
Returns the GrafPort object that provides QuickDraw-like
drawing and event routines onto this panel. |
java.awt.Dimension |
getPreferredSize()
|
DrawingStuff |
getStuff()
Returns the attached DrawingStuff object that provides
drawings with automatic repaint and interfaces for keyboard and mouse
events. |
boolean |
imageUpdate(java.awt.Image img,
int flags,
int x,
int y,
int width,
int height)
Repaints the panel when the image has changed. |
void |
init()
The init method as for any applet. |
void |
paint(java.awt.Graphics g)
Invoked by the event handler when this panel needs to be repaint. |
void |
prefSize(java.awt.Dimension size)
|
void |
start()
The start method as for any applet. |
void |
stop()
The stop method as for any applet. |
void |
update(java.awt.Graphics g)
|
| Methods inherited from class java.applet.Applet |
|---|
getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus |
| Methods inherited from class java.awt.Panel |
|---|
addNotify |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DrawingApplet()
DrawingApplet used as an applet.
A GrafPort will be later allocated during the call to the
init() method.
init()| Method Detail |
|---|
public void init()
start() method is called.
Any subclass of DrawingApplet that overrides this method,
should call this in turn to provides suitable initialization.
init in class java.applet.AppletApplet.init()public void start()
init() method and each time the applet is revisited
in a Web page.
This method does nothing and any subclass of DrawingApplet should
override it, to perform any drawings each time the Web page containing it is
visited.
start in class java.applet.AppletApplet.start()public void stop()
This method does nothing and any subclass of DrawingApplet has
to override it, when stop processing is needed.
stop in class java.applet.AppletApplet.stop()public void destroy()
stop() method will always
be called before destroy().
Any subclass of DrawingApplet that overrides this method,
should call this in turn to provides suitable memory cleaning.
destroy in class java.applet.AppletApplet.destroy()public java.lang.String getAppletInfo()
Any subclass of DrawingApplet that overrides this method,
should include this one.
getAppletInfo in class java.applet.Appletpublic DrawingStuff getStuff()
DrawingStuff object that provides
drawings with automatic repaint and interfaces for keyboard and mouse
events.
DrawingStuff objectpublic GrafPort getPort()
GrafPort object that provides QuickDraw-like
drawing and event routines onto this panel.
GrafPort objectpublic void dispose()
DrawingApplet.
This method must be called to release the resources.
public void finalize()
DrawingApplet.
finalize in class java.lang.Objectpublic void prefSize(java.awt.Dimension size)
public java.awt.Dimension getPreferredSize()
getPreferredSize in class java.awt.Containerpublic void paint(java.awt.Graphics g)
Any subclass of DrawingApplet that overrides this method,
should call this in turn to provides suitable update.
paint in class java.awt.Containerg - the specified Graphics object for painting onto
this panelpublic void update(java.awt.Graphics g)
update in class java.awt.Containerpublic void componentResized(java.awt.event.ComponentEvent e)
componentResized in interface java.awt.event.ComponentListenerpublic void componentMoved(java.awt.event.ComponentEvent e)
componentMoved in interface java.awt.event.ComponentListenerpublic void componentShown(java.awt.event.ComponentEvent e)
componentShown in interface java.awt.event.ComponentListenerpublic void componentHidden(java.awt.event.ComponentEvent e)
componentHidden in interface java.awt.event.ComponentListener
public boolean imageUpdate(java.awt.Image img,
int flags,
int x,
int y,
int width,
int height)
imageUpdate in interface java.awt.image.ImageObserverimageUpdate in class java.awt.Component
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||