|
|||||||
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
javax.swing.JApplet
objectdraw.Controller
public class Controller
Controller is a Swing compatible class designed to be extended to produce programs that employ a GUI but do not include graphics displayed in a DrawingCanvas. To write such a program, a programmer should extend this class defining a begin method that performs initialization, including constructing the programs GUI, appropriate instance variable, and any private methods needed to simplify the definition of the begin method or to handle GUI events.
AWTController
,
WindowController
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JApplet |
---|
JApplet.AccessibleJApplet |
Nested classes/interfaces inherited from class java.applet.Applet |
---|
Applet.AccessibleApplet |
Nested classes/interfaces inherited from class java.awt.Panel |
---|
Panel.AccessibleAWTPanel |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
(package private) static int |
DEFAULT_WINDOW_HEIGHT
|
(package private) static int |
DEFAULT_WINDOW_WIDTH
default sizes for Controller window when run outside an applet viewer |
Fields inherited from class javax.swing.JApplet |
---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
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 | |
---|---|
Controller()
|
Method Summary | |
---|---|
void |
begin()
Programs written by extending Controller can perform any required initialization by defining a begin method containing the code to perform the initialization steps. |
void |
destroy()
This predefined method is invoked by the appletviewer or web browser running a program that extends Controller when the program's execution is complete. |
AudioClip |
getAudio(String path)
Retrieves an audio file |
Image |
getImage(String path)
Retrieves an image. |
static String |
getVersion()
Determine the version of the objectdraw library being used. |
protected void |
helpinit()
|
void |
init()
This predefined method is invoked by the applet viewer or web browser used to run a program that extends Controller to initiate the execution of the program. |
void |
placeInFrame(int width,
int height)
Associate of this controller with an independent window. |
void |
resize(int width,
int height)
Resize the window in which this controller is running (if possible) |
protected void |
setup()
Initialization common to Controllers and WindowControllers. |
void |
start()
This predefined method is invoked by the appletviewer or web browser running a program that extends Controller when the program should commence or resume active execution. |
void |
startController()
Run this controller in an independent window of default size. |
void |
startController(int width,
int height)
Run this controller in an independent window of the specified size. |
void |
stop()
This predefined method is invoked by the appletviewer or web browser running a program that extends Controller when the program should cease active execution. |
Methods inherited from class javax.swing.JApplet |
---|
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isRootPaneCheckingEnabled, paramString, remove, repaint, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update |
Methods inherited from class java.applet.Applet |
---|
getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, isValidateRoot, newAudioClip, play, play, resize, setStub, showStatus |
Methods inherited from class java.awt.Panel |
---|
addNotify |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static final int DEFAULT_WINDOW_HEIGHT
static final int DEFAULT_WINDOW_WIDTH
Constructor Detail |
---|
public Controller()
Method Detail |
---|
public void begin()
public final void destroy()
destroy
in class Applet
public AudioClip getAudio(String path)
path
- the file path name or URL of the desired audio file
public Image getImage(String path)
path
- the file path name or URL of the desired image.
public static String getVersion()
protected void helpinit()
public final void init()
init
in class Applet
public void placeInFrame(int width, int height)
width
- the width of the desired windowheight
- the height of the desired windowpublic void resize(int width, int height)
resize
in class Applet
width
- the new width for the windowheight
- the new height for the windowprotected void setup()
public final void start()
start
in class Applet
public void startController()
public void startController(int width, int height)
width
- the width of the desired windowheight
- the height of the desired windowpublic final void stop()
start
method. The stop method ensures that all ActiveObjects that have been created
by the program are notified that the program has been suspended.
Programmers extending this class should not include their
own definition of stop.
stop
in class Applet
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |