|
||||||||||
| 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
dasher.applet.JDasherApplet
public class JDasherApplet
Applet containing a JDasherScreen panel, a JDasherEdit TextBox, and a set of menus to set relevant parameters.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JApplet |
|---|
javax.swing.JApplet.AccessibleJApplet |
| Nested classes/interfaces inherited from class java.applet.Applet |
|---|
java.applet.Applet.AccessibleApplet |
| Nested classes/interfaces inherited from class java.awt.Panel |
|---|
java.awt.Panel.AccessibleAWTPanel |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
java.lang.String |
buildDate
Date of last build; appears in About box |
JDasher |
Dasher
Instance of Dasher which does the work |
private JDasherEdit |
EditBox
Edit box in which typed text appears |
java.awt.datatransfer.Clipboard |
m_Clipboard
Clipboard object |
private JDasherMenuBar |
MenuBar
Our menu bar |
private ScreenOverlay |
ProgressMeter
Overlay to display when Dasher is locked |
private JDasherScreen |
Screen
Our Screen panel |
private java.util.Timer |
taskScheduler
Scheduling agent used to cue new frames |
| 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 | |
|---|---|
JDasherApplet()
|
|
| Method Summary | |
|---|---|
javax.swing.JPanel |
constructGUIPanel(java.awt.Dimension size)
Sets up a Panel containing the entire Applet's GUI, and returns the Panel. |
JDasherMenuBar |
constructMenus()
Produces our menu bar (a JDasherMenuBar) and returns it. |
java.lang.String |
getCurrentEditBoxText()
Retrieves the current EditBox text. |
private int |
getMessageType(int type)
Converts Dasher's message dialog types into JOptionPane's constants with the same meaning. |
void |
handleEvent(CEvent event)
The Applet responds to the following parameter events: |
void |
init()
Instantiates Dasher, gets a handle to the system clipboard if possible, calls constructGUIPanel to produce our GUI, and informs Dasher of the Screen Panel created by this method using the ChangeScreen method. |
boolean |
isDataFlavorAvailable(java.awt.datatransfer.DataFlavor flavour)
Checks with the clipboard whether a given data flavour is enabled. |
void |
keyPressed(java.awt.event.KeyEvent e)
We respond to the following key presses: |
void |
keyReleased(java.awt.event.KeyEvent e)
Upon releasing the space bar, we signal Dasher a KeyDown event with a key of zero. |
void |
keyTyped(java.awt.event.KeyEvent arg0)
Ignored |
void |
menuCopy()
Copies the current edit box selection to the clipboard if possible. |
void |
menuCut()
Cuts the current edit box selection to the clipboard if possible. |
void |
menuExit()
Quits Dasher |
void |
menuHelpAbout()
Displays an About dialog showing the compilation date. |
void |
menuNew()
Blanks the EditBox and invalidates our current context. |
void |
menuPaste()
Attempts to paste from the clipboard, overwriting our current EditBox selection if there is one. |
void |
menuSelFont()
Opens the Select Font dialog in order to choose a new EditBox font |
void |
menuSetAlph(java.lang.String newalph)
Sets the currently selected alphabet |
void |
menuSetColours(java.lang.String newcolours)
Sets the currently selected colourscheme |
void |
menuSetDasherSpeed(int speed)
Sets Dasher's LP_MAX_BITRATE parameter to a given value |
void |
menuSetFontSize(int size)
Sets the Dasher font size (LP_DASHER_FONTSIZE) to a given value. |
void |
menuSetInputFilter(java.lang.String filter)
Sets the input filter (SP_INPUT_FILTER) to a given String. |
void |
menuSetLMID(int LMID)
Sets the currently selected language model to a given ID. |
void |
menuSetLMLearn(boolean enabled)
Sets BP_LM_ADAPTIVE |
void |
menuSetMouseLine(boolean enabled)
Sets BP_DRAW_MOUSE_LINE |
void |
menuSetSpeedAuto(boolean enabled)
Sets BP_AUTO_SPEEDCONTROL |
void |
menuSetStartMouse(boolean enabled)
Sets BP_START_MOUSE |
void |
menuSetStartSpace(boolean enabled)
Sets BP_START_SPACE |
void |
mouseClicked(java.awt.event.MouseEvent e)
MouseClicks are responded to by feeding Dasher a KeyDown event. |
void |
mouseEntered(java.awt.event.MouseEvent arg0)
Ignored |
void |
mouseExited(java.awt.event.MouseEvent arg0)
Ignored |
void |
mousePressed(java.awt.event.MouseEvent arg0)
Ignored |
void |
mouseReleased(java.awt.event.MouseEvent arg0)
Ignored |
void |
Redraw()
Calls the applet's repaint method to trigger a redraw of Dasher. |
void |
regMouseMotionListener(java.awt.event.MouseMotionListener e)
Adds a MouseMotionListener; requested by Dasher in order to hook its JMouseInput object up to hear mouse events. |
void |
setNewFont(java.awt.Font f)
Sets our edit box font |
void |
stop()
Cancels our new frame scheduler, and calls Dasher's DestroyInterface method to give it an opportunity to clean up if necessary. |
| Methods inherited from class javax.swing.JApplet |
|---|
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
| Methods inherited from class java.applet.Applet |
|---|
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start |
| 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, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, 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, imageUpdate, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, 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 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public JDasher Dasher
private JDasherScreen Screen
private JDasherMenuBar MenuBar
private ScreenOverlay ProgressMeter
private JDasherEdit EditBox
public java.awt.datatransfer.Clipboard m_Clipboard
private java.util.Timer taskScheduler
public final java.lang.String buildDate
| Constructor Detail |
|---|
public JDasherApplet()
| Method Detail |
|---|
public void init()
Finally, we call constructMenus to produce our menu bar.
init in class java.applet.Appletpublic javax.swing.JPanel constructGUIPanel(java.awt.Dimension size)
The Panel contains a JDasherScreen (which is stored in the Screen variable) and a JDasherEdit (stored in EditBox).
size - Size of the panel to be created
public JDasherMenuBar constructMenus()
After instantiating, its options are set from Dasher's current settings. For example, we cause the current Alphabet to be set as 'selected' in the menu bar.
public void handleEvent(CEvent event)
BP_DASHER_PAUSED: We start/stop requesting frames at a regular interval depending on whether Dasher is currently paused.
LP_LANGUAGE_MODEL_ID: Updates our MenuBar's currently selected language model to reflect that which has been chosen.
SP_COLOUR_ID: Updates our MenuBar's currently selected colour scheme to reflect that which has been chosen. Usually this occurs in response to an alphabet specifying its own colour scheme.
The Applet also responds to LockEvents by showing our ScreenOverlay when locked and updating its progress bar, and MessageEvents by showing a message dialog.
Finally we pass the event on to the EditBox, in case some handling is required there as well.
handleEvent in interface JDasherHostevent - Event being passedprivate int getMessageType(int type)
If asked to convert an invalid message type, -1 is returned.
type - Type to convert.
public void mouseClicked(java.awt.event.MouseEvent e)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent arg0)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent arg0)
mouseExited in interface java.awt.event.MouseListenerpublic void mousePressed(java.awt.event.MouseEvent arg0)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseReleased(java.awt.event.MouseEvent arg0)
mouseReleased in interface java.awt.event.MouseListenerpublic void keyPressed(java.awt.event.KeyEvent e)
CTRL: Set speed boost factor to 175
SHIFT: Set speed boost factor to 25.
keyPressed in interface java.awt.event.KeyListenerpublic void keyReleased(java.awt.event.KeyEvent e)
If either CTRL or SHIFT are released, the speed boost constant is reset to 100, 175 or 25, dependent on which keys are still down.
keyReleased in interface java.awt.event.KeyListenerpublic void keyTyped(java.awt.event.KeyEvent arg0)
keyTyped in interface java.awt.event.KeyListenerpublic void stop()
Ultimately any neglected cleaning is likely not to cause a problem, as we are about to stop the application.
stop in class java.applet.Appletpublic void Redraw()
This method is called by Dasher when it wishes to be redrawn; the process has to be started from the top because it is tied in with Swing's painting architecture.
Redraw in interface JDasherHostpublic void regMouseMotionListener(java.awt.event.MouseMotionListener e)
regMouseMotionListener in interface JDasherHoste - Listener to addpublic void setNewFont(java.awt.Font f)
setNewFont in interface FontListenerf - New fontpublic void menuCopy()
menuCopy in interface JDasherMenuBarListenerpublic void menuCut()
menuCut in interface JDasherMenuBarListenerpublic void menuExit()
menuExit in interface JDasherMenuBarListenerpublic void menuHelpAbout()
menuHelpAbout in interface JDasherMenuBarListenerpublic void menuNew()
menuNew in interface JDasherMenuBarListenerpublic void menuPaste()
menuPaste in interface JDasherMenuBarListenerpublic void menuSelFont()
menuSelFont in interface JDasherMenuBarListenerpublic void menuSetDasherSpeed(int speed)
menuSetDasherSpeed in interface JDasherMenuBarListenerspeed - New LP_MAX_BITRATEpublic void menuSetFontSize(int size)
menuSetFontSize in interface JDasherMenuBarListenersize - New size; either 1, 2 or 4.public void menuSetInputFilter(java.lang.String filter)
menuSetInputFilter in interface JDasherMenuBarListenerfilter - Name of new input filterpublic void menuSetLMID(int LMID)
If an ID of 5 (corresponding to the RemotePPM language model) is selected, we first prompt the user to name a host and set the SP_LM_HOST parameter to their chosen value.
In any case, we end up setting LP_LANGUAGE_MODEL_ID.
menuSetLMID in interface JDasherMenuBarListenerLMID - New LM IDpublic void menuSetLMLearn(boolean enabled)
menuSetLMLearn in interface JDasherMenuBarListenerenabled - New valuepublic void menuSetMouseLine(boolean enabled)
menuSetMouseLine in interface JDasherMenuBarListenerenabled - New valuepublic void menuSetSpeedAuto(boolean enabled)
menuSetSpeedAuto in interface JDasherMenuBarListenerenabled - New valuepublic void menuSetStartMouse(boolean enabled)
menuSetStartMouse in interface JDasherMenuBarListenerenabled - New valuepublic void menuSetStartSpace(boolean enabled)
menuSetStartSpace in interface JDasherMenuBarListenerenabled - New valuepublic void menuSetAlph(java.lang.String newalph)
menuSetAlph in interface JDasherMenuBarListenernewalph - Alphabet to selectpublic void menuSetColours(java.lang.String newcolours)
menuSetColours in interface JDasherMenuBarListenernewcolours - Colour scheme to selectpublic boolean isDataFlavorAvailable(java.awt.datatransfer.DataFlavor flavour)
Typically this is used to check whether it is sensible to attempt Paste at the moment.
isDataFlavorAvailable in interface JDasherMenuBarListenerflavour - Flavour to check availability
public java.lang.String getCurrentEditBoxText()
Thankfully, this doesn't work on FireFox.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||