|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--java.awt.Panel
|
+--java.applet.Applet
|
+--BaseApplet
|
+--BaseApplet2
Implements additional helper methods for managing a control panel
along the bottom edge of the applet. Applets not wishing to use such a
panel should extend BaseApplet instead.
Any buttons, textfields, or checkboxes added to the panel will be
automatically registered to trigger ActionEvents on
interaction with the user.
The add() and
setLayout methods refer to this panel
instead of the whole applet.
| Inner Class Summary | |
(package private) class |
BaseApplet2.FixedButton
Mozilla-friendly Button |
(package private) class |
BaseApplet2.FixedCheckbox
Mozilla-friendly Checkbox |
class |
BaseApplet2.GraphClickListener
|
| Inner classes inherited from class BaseApplet |
BaseApplet.MozillaWorkaround,
BaseApplet.ResizeListener |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AWTTreeLock |
| Field Summary | |
protected java.util.Vector |
boxes
|
protected java.util.Vector |
buttons
|
protected boolean |
enablePrompt
|
protected java.util.Vector |
fields
|
protected java.lang.Object |
focus
|
protected java.awt.Panel |
panel
|
protected java.awt.Label |
statusLabel
|
protected boolean |
useSwing
|
static int |
V_MARGIN
|
| Fields inherited from class BaseApplet |
buffer,
GRAPH_MARGIN,
refresh,
resizeListener,
safetyLimit,
useBuffer |
| Fields inherited from class java.applet.Applet |
serialVersionUID,
stub |
| Fields inherited from class java.awt.Panel |
base,
nameCounter,
serialVersionUID |
| Fields inherited from class java.awt.Container |
component,
containerListener,
containerSerializedDataVersion,
dispatcher,
layoutMgr,
maxSize,
ncomponents,
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 | |
BaseApplet2()
|
|
| Method Summary | |
java.awt.Component |
add(java.awt.Component c)
Adds a component to the control panel, and register()s the component. |
java.awt.Component |
add(java.awt.Component c,
java.lang.String text)
Adds a text label to the control panel, followed by the specified component, and register()s the component. |
java.awt.Button |
addButton(java.lang.String label)
Creates a button, and adds it to the control panel. |
java.awt.Checkbox |
addCheckbox(java.lang.String label,
boolean value)
Creates a checkbox, and adds it to the control panel. |
java.awt.TextField |
addField(java.lang.String label,
double value)
Creates a text field, and adds it to the control panel. |
java.awt.TextField |
addField(java.lang.String label,
int value)
Creates a text field, and adds it to the control panel. |
java.awt.TextField |
addField(java.lang.String label,
java.lang.String value)
Creates a text field, and adds it to the control panel. |
protected void |
addListeners()
Used internally to add listeners for all registered components |
void |
focusGained(java.awt.event.FocusEvent fe)
Used to track focus to discern user-triggered changes from automatic changes. |
void |
focusLost(java.awt.event.FocusEvent fe)
Used to track focus to discern user-triggered changes from automatic changes. |
double |
getDouble(java.awt.TextField tf)
Parses a TextField into a double. |
int |
getGraphHeight()
Returns the available space for graphs (or whatever the remainder of the display is to be used for). |
int |
getInt(java.awt.TextField tf)
Parses a TextField into an int. |
void |
init()
Performs extra initialisation, including adding a panel to the bottom of the applet. |
protected void |
lockControls()
Disables all registed components |
protected java.awt.Component |
makeButton(java.lang.String label)
Returns an instance of Button, of a subclass chosen
at the discretion of the applet. |
protected java.awt.Container |
makePanel()
Returns an instance of Container, of a subclass chosen
at the discretion of the applet. |
protected void |
paintDashedLineH(java.awt.Graphics g,
int x,
int y,
int x2,
int dashLen)
Helper method to display horizontal dashed lines |
protected void |
paintDashedLineV(java.awt.Graphics g,
int x,
int y,
int y2,
int dashLen)
Helper method to display vertical dashed lines |
protected void |
register(java.awt.Component c)
Registers a component with the applet. |
protected void |
removeListeners()
Used internally to add listeners for all registered components |
private static void |
setComponentsEnabled(java.util.Vector v,
boolean b)
Used internally to enable or disable a Vector of
components. |
void |
setLayout(java.awt.LayoutManager lm)
Sets the layout manager to use for the control panel. |
void |
setPromptEnabled(boolean b)
Used to enable or disable user input prompting. |
void |
start()
Applets should use this method to perform any final initialisation necessary to "activate" the applet |
void |
stop()
When this method is called, the applet should cease any user interaction. |
void |
textValueChanged(java.awt.event.TextEvent te)
Called when the contents of a text field have changed. |
static java.lang.String |
toString(double d)
|
protected void |
unlockControls()
Enables all registed components |
| Methods inherited from class BaseApplet |
actionPerformed,
changeFont,
doPaint,
forcePaint,
getAppletInfo,
getParameterInfo,
itemStateChanged,
paint,
refresh,
update |
| Methods inherited from class java.applet.Applet |
destroy,
getAppletContext,
getAudioClip,
getAudioClip,
getCodeBase,
getDocumentBase,
getImage,
getImage,
getLocale,
getParameter,
isActive,
newAudioClip,
play,
play,
resize,
resize,
setStub,
showStatus |
| Methods inherited from class java.awt.Panel |
|
| Methods inherited from class java.awt.Container |
add,
add,
add,
add,
addContainerListener,
addImpl,
applyOrientation,
countComponents,
deliverEvent,
dispatchEventImpl,
dispatchEventToSelf,
doLayout,
eventEnabled,
findComponentAt,
findComponentAt,
getAlignmentX,
getAlignmentY,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents_NoClientCode,
getComponents,
getCursorTarget,
getInsets,
getLayout,
getMaximumSize,
getMinimumSize,
getMouseEventTarget,
getPreferredSize,
getWindow,
initIDs,
insets,
invalidate,
invalidateTree,
isAncestorOf,
layout,
lightweightPrint,
list,
list,
locate,
minimumSize,
nextFocus,
paintComponents,
paramString,
postProcessKeyEvent,
postsOldMouseEvents,
preferredSize,
preProcessKeyEvent,
print,
printComponents,
printOneComponent,
processContainerEvent,
processEvent,
proxyEnableEvents,
proxyRequestFocus,
readObject,
remove,
remove,
removeAll,
removeContainerListener,
removeNotify,
setCursor,
setFocusOwner,
setFont,
transferFocus,
updateCursor,
validate,
validateTree,
writeObject |
| 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,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
firePropertyChange,
getBackground,
getBounds,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont_NoClientCode,
getFont,
getFontMetrics,
getForeground,
getGraphics,
getHeight,
getInputContext,
getInputMethodRequests,
getIntrinsicCursor,
getLocation,
getLocation,
getLocationOnScreen,
getName,
getNativeContainer,
getParent_NoClientCode,
getParent,
getPeer,
getSize,
getSize,
getToolkit,
getToolkitImpl,
getTreeLock,
getWidth,
getWindowForObject,
getX,
getY,
gotFocus,
handleEvent,
hasFocus,
hide,
imageUpdate,
inside,
isDisplayable,
isDoubleBuffered,
isEnabled,
isEnabledImpl,
isFocusTraversable,
isLightweight,
isOpaque,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processFocusEvent,
processInputMethodEvent,
processKeyEvent,
processMouseEvent,
processMouseMotionEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
removePropertyChangeListener,
removePropertyChangeListener,
repaint,
repaint,
repaint,
repaint,
requestFocus,
reshape,
setBackground,
setBounds,
setBounds,
setComponentOrientation,
setDropTarget,
setEnabled,
setForeground,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
setVisible,
show,
show,
size,
toString,
transferFocus |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
wait,
wait,
wait |
| Field Detail |
protected java.lang.Object focus
protected java.util.Vector buttons
protected java.util.Vector fields
protected java.util.Vector boxes
protected java.awt.Panel panel
protected java.awt.Label statusLabel
protected boolean useSwing
protected boolean enablePrompt
public static final int V_MARGIN
| Constructor Detail |
public BaseApplet2()
| Method Detail |
public void init()
public void setLayout(java.awt.LayoutManager lm)
lm - The layout managerprotected java.awt.Container makePanel()
Container, of a subclass chosen
at the discretion of the applet.protected java.awt.Component makeButton(java.lang.String label)
Button, of a subclass chosen
at the discretion of the applet.label - The text which will appear on the buttonpublic java.awt.Button addButton(java.lang.String label)
label - The text to display on the button
public java.awt.TextField addField(java.lang.String label,
java.lang.String value)
label - The initial text for the field
public java.awt.TextField addField(java.lang.String label,
double value)
value - The initial value for the field
public java.awt.TextField addField(java.lang.String label,
int value)
value - The initial value for the field
public java.awt.Checkbox addCheckbox(java.lang.String label,
boolean value)
value - The initial value for the fieldprotected void register(java.awt.Component c)
ItemEvent
or ActionEvent generated by the component will now be
passed on to the
actionPerformed() method
implemented by the subclass.c - The component to registerpublic java.awt.Component add(java.awt.Component c)
register()s the component.c - The component to add
public java.awt.Component add(java.awt.Component c,
java.lang.String text)
register()s the component.c - The component to addtext - The label for the componentpublic void start()
public void stop()
start().protected void addListeners()
protected void removeListeners()
public int getGraphHeight()
public int getInt(java.awt.TextField tf)
TextField into an int.tf - The field to parsepublic double getDouble(java.awt.TextField tf)
TextField into a double.tf - The field to parseprotected void lockControls()
protected void unlockControls()
private static void setComponentsEnabled(java.util.Vector v,
boolean b)
Vector of
components.v - The vector of componentsb - true if the components are to be enabled,
else falsepublic void textValueChanged(java.awt.event.TextEvent te)
statusLabel will prompt the user to press return.public void focusGained(java.awt.event.FocusEvent fe)
public void focusLost(java.awt.event.FocusEvent fe)
public void setPromptEnabled(boolean b)
protected void paintDashedLineH(java.awt.Graphics g,
int x,
int y,
int x2,
int dashLen)
g - The Graphics surface on which to paintx - The x-coordinate of the start of the liney - The y-coordinate of the start of the linex2 - The x-coordinate of the end of the linedashLen - The size of dash to use
protected void paintDashedLineV(java.awt.Graphics g,
int x,
int y,
int y2,
int dashLen)
g - The Graphics surface on which to paintx - The x-coordinate of the start of the liney - The y-coordinate of the start of the liney2 - The y-coordinate of the end of the linedashLen - The size of dash to usepublic static java.lang.String toString(double d)
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||