|
|||||||||
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.Window
java.awt.Frame
maclib.DrawingFrame
public class DrawingFrame
A DrawingFrame
is a top-level window containing a
DrawingApplet
, used for a drawing panel.
The DrawingApplet
provides automatic repaint, using
an off-screen image, and also listeners for keyboard and mouse events.
Most of these features are implemented in an attached
DrawingStuff
object.
Usually, a DrawingFrame
is instanciated during the
initialization of a GrafPort
that provides QuickDraw-like
drawing and event routines onto the attached drawing panel.
A DrawingFrame
may be also directly instanciated and a
GrafPort
object is then allocated and it may be obtained by
a call to the getPort
method.
DrawingApplet
,
DrawingStuff
,
GrafPort
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.BaselineResizeBehavior |
Field Summary | |
---|---|
static int |
DEFAULT_FRAME_HEIGHT
The default initial height for a new DrawingFrame . |
static int |
DEFAULT_FRAME_WIDTH
The default initial width for a new DrawingFrame . |
Fields inherited from class java.awt.Frame |
---|
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
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 | |
---|---|
DrawingFrame()
Constructs and initializes a DrawingFrame having :
the title "Drawing" ,
the default initial size for the frame,
the default size for the off-screen image
|
|
DrawingFrame(java.lang.String title)
Constructs and initializes a DrawingFrame having :
the specified title,
the default initial size for the frame,
the default size for the off-screen image
|
|
DrawingFrame(java.lang.String title,
int width,
int height)
Constructs and initializes a DrawingFrame having :
the specified title,
the specified initial size for the frame,
the default final size for the off-screen image
|
|
DrawingFrame(java.lang.String title,
int width,
int height,
int fullWidth,
int fullHeight)
Constructs and initializes a DrawingFrame having :
the specified title,
the specified initial size for the frame,
the specified final size for the off-screen image
|
Method Summary | |
---|---|
void |
dispose()
Disposes of this DrawingFrame and attached objects. |
void |
finalize()
Called by the garbage collector when there are no more reference to this DrawingFrame . |
java.lang.String |
getName()
Returns the title given to this DrawingFrame . |
GrafPort |
getPort()
Returns the GrafPort object that provides QuickDraw-like
drawing and event routines onto the attached drawing panel. |
java.awt.Rectangle |
getPortBounds()
Gets the drawing bounds of this DrawingFrame . |
DrawingStuff |
getStuff()
Returns the attached DrawingStuff object that provides
automatic repaint and interfaces for keyboard and mouse events. |
void |
setPortBounds(java.awt.Rectangle b)
Sets the drawing bounds of this DrawingFrame as
specified by the given Rectangle object. |
void |
setPortSize(int width,
int height)
Sets the drawing size of this DrawingFrame as specified. |
void |
showStatus(java.lang.String s)
Prints a string of text (for user information) on System.out . |
void |
windowActivated(java.awt.event.WindowEvent e)
Invoked by the event handler when this DrawingFrame
is activated and will receive keyboard events. |
void |
windowClosed(java.awt.event.WindowEvent e)
Invoked by the event handler when this DrawingFrame has
been closed by a call to dispose . |
void |
windowClosing(java.awt.event.WindowEvent e)
Invoked by the event handler when this DrawingFrame is
in the process of being closed by the user. |
void |
windowDeactivated(java.awt.event.WindowEvent e)
Invoked by the event handler when this DrawingFrame
is de-activated and will no longer receive keyboard event. |
void |
windowDeiconified(java.awt.event.WindowEvent e)
Invoked by the event handler when this DrawingFrame
is de-iconified. |
void |
windowIconified(java.awt.event.WindowEvent e)
Invoked by the event handler when this DrawingFrame
is iconified. |
void |
windowOpened(java.awt.event.WindowEvent e)
Invoked by the event handler when this DrawingFrame
has been opened, that is, the first time it is made visible. |
Methods inherited from class java.awt.Frame |
---|
addNotify, getAccessibleContext, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated |
Methods inherited from class java.awt.Window |
---|
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, 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, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
---|
getFont, postEvent |
Field Detail |
---|
public static final int DEFAULT_FRAME_WIDTH
DrawingFrame
.
DrawingFrame(java.lang.String)
,
Constant Field Valuespublic static final int DEFAULT_FRAME_HEIGHT
DrawingFrame
.
DrawingFrame(java.lang.String)
,
Constant Field ValuesConstructor Detail |
---|
public DrawingFrame(java.lang.String title, int width, int height, int fullWidth, int fullHeight)
DrawingFrame
having :
title
- the title given to this DrawingFrame
width
- the initial width of the frameheight
- the initial height of the framefullWidth
- the final width of the off-screen imagefullHeight
- the final height of the off-screen imagepublic DrawingFrame(java.lang.String title, int width, int height)
DrawingFrame
having :
title
- the title given to this DrawingFrame
width
- the initial width of the frameheight
- the initial height of the frameDrawingStuff.DEFAULT_SCREEN_WIDTH
,
DrawingStuff.DEFAULT_SCREEN_HEIGHT
public DrawingFrame(java.lang.String title)
DrawingFrame
having :
title
- the title given to this DrawingFrame
DEFAULT_FRAME_WIDTH
,
DEFAULT_FRAME_HEIGHT
,
DrawingStuff.DEFAULT_SCREEN_WIDTH
,
DrawingStuff.DEFAULT_SCREEN_HEIGHT
public DrawingFrame()
DrawingFrame
having :
"Drawing"
,
DEFAULT_FRAME_WIDTH
,
DEFAULT_FRAME_HEIGHT
,
DrawingStuff.DEFAULT_SCREEN_WIDTH
,
DrawingStuff.DEFAULT_SCREEN_HEIGHT
Method Detail |
---|
public DrawingStuff getStuff()
DrawingStuff
object that provides
automatic repaint and interfaces for keyboard and mouse events.
DrawingStuff
objectpublic GrafPort getPort()
GrafPort
object that provides QuickDraw-like
drawing and event routines onto the attached drawing panel.
GrafPort
objectpublic java.lang.String getName()
DrawingFrame
.
Overrides getName
of class Component
, so
that the title is returned in place of the internal name.
getName
in class java.awt.Component
DrawingFrame
public void dispose()
DrawingFrame
and attached objects.
dispose
in class java.awt.Window
public void finalize() throws java.lang.Throwable
DrawingFrame
.
finalize
in class java.lang.Object
java.lang.Throwable
public void setPortSize(int width, int height)
DrawingFrame
as specified.
width
- the width of the panel in pixelsheight
- the height of the panel in pixelssetPortBounds(java.awt.Rectangle)
public void setPortBounds(java.awt.Rectangle b)
DrawingFrame
as
specified by the given Rectangle
object.
a
- Rectangle
object that specifies the
screen coordinates of the drawing areagetPortBounds()
public java.awt.Rectangle getPortBounds()
DrawingFrame
.
Rectangle
object filled with the
screen coordinates of the drawing areasetPortBounds(java.awt.Rectangle)
public void windowOpened(java.awt.event.WindowEvent e)
DrawingFrame
has been opened, that is, the first time it is made visible.
windowOpened
in interface java.awt.event.WindowListener
public void windowClosing(java.awt.event.WindowEvent e)
DrawingFrame
is
in the process of being closed by the user.
This DrawingFrame
is disposed. The application terminates
when the last DrawingFrame
is disposed.
windowClosing
in interface java.awt.event.WindowListener
public void windowClosed(java.awt.event.WindowEvent e)
DrawingFrame
has
been closed by a call to dispose
.
windowClosed
in interface java.awt.event.WindowListener
public void windowIconified(java.awt.event.WindowEvent e)
DrawingFrame
is iconified.
windowIconified
in interface java.awt.event.WindowListener
public void windowDeiconified(java.awt.event.WindowEvent e)
DrawingFrame
is de-iconified.
windowDeiconified
in interface java.awt.event.WindowListener
public void windowActivated(java.awt.event.WindowEvent e)
DrawingFrame
is activated and will receive keyboard events.
windowActivated
in interface java.awt.event.WindowListener
public void windowDeactivated(java.awt.event.WindowEvent e)
DrawingFrame
is de-activated and will no longer receive keyboard event.
windowDeactivated
in interface java.awt.event.WindowListener
public void showStatus(java.lang.String s)
System.out
.
s
- the string to be printed
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |