|
|||||||||
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.Dialog
javax.swing.JDialog
tnt.gui.KeyLetterDialog
public class KeyLetterDialog
Encapsulates a technique to allow users to map letters to key, but to also restrict their input to valid selections.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JDialog |
---|
javax.swing.JDialog.AccessibleJDialog |
Nested classes/interfaces inherited from class java.awt.Dialog |
---|
java.awt.Dialog.AccessibleAWTDialog |
Nested classes/interfaces inherited from class java.awt.Window |
---|
java.awt.Window.AccessibleAWTWindow |
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 | |
---|---|
protected javax.swing.JRadioButton |
bothThumbs
|
protected javax.swing.JButton |
cancelButton
|
protected javax.swing.JCheckBox[] |
chkBoxes
|
protected javax.swing.JTextField |
idField
|
protected java.lang.StringBuilder |
keys
|
protected javax.swing.JRadioButton |
leftThumb
|
protected javax.swing.JRadioButton |
letterKey
|
static java.lang.String |
LETTERS
Each character in this string represents a letter or function that must be mapped. |
protected javax.swing.JRadioButton |
nextKey
|
protected javax.swing.JButton |
okButton
|
protected javax.swing.JRadioButton |
rightThumb
|
protected javax.swing.JRadioButton |
spaceKey
|
Fields inherited from class javax.swing.JDialog |
---|
accessibleContext, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface javax.swing.WindowConstants |
---|
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
KeyLetterDialog(java.awt.Frame owner)
Initializes the modal dialog. |
|
KeyLetterDialog(java.awt.Frame owner,
java.lang.String mapping)
Initializes the dialog with the passed mapping and makes it modal to its owner. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent ae)
|
void |
deleteKey(char keyID)
Deletes mappings associated with the passed key id. |
java.lang.String |
getChars()
Returns the characters mapped to the last defined key. |
char |
getKeyID()
Returns the key id of the last defined key. |
java.lang.String |
getKeyMapping()
Each character in the returned string represents a key id, whose key is mapped to the corresponding letter or function in LETTERS at the same index. |
int |
getThumb()
Returns an integer representing the thumb assigned to the last defined key. |
void |
itemStateChanged(java.awt.event.ItemEvent e)
|
java.lang.String |
notMapped()
Returns letters and functions (i.e., NEXT and SPACE) that have not yet been mapped to keys. |
void |
setMapping(java.lang.String mapping)
Sets the key-letter mapping to the passed parameter. |
void |
setVisible(boolean b)
Displays or hides this dialog. |
void |
setVisible(boolean b,
KeyButton key)
Displays or hides this dialog. |
void |
windowActivated(java.awt.event.WindowEvent we)
|
void |
windowClosed(java.awt.event.WindowEvent we)
|
void |
windowClosing(java.awt.event.WindowEvent we)
|
void |
windowDeactivated(java.awt.event.WindowEvent we)
|
void |
windowDeiconified(java.awt.event.WindowEvent we)
|
void |
windowIconified(java.awt.event.WindowEvent we)
|
void |
windowOpened(java.awt.event.WindowEvent we)
|
Methods inherited from class javax.swing.JDialog |
---|
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
Methods inherited from class java.awt.Dialog |
---|
addNotify, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show |
Methods inherited from class java.awt.Window |
---|
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, 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, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, 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, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, 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, 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, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String LETTERS
protected java.lang.StringBuilder keys
protected javax.swing.JRadioButton letterKey
protected javax.swing.JRadioButton nextKey
protected javax.swing.JRadioButton spaceKey
protected javax.swing.JRadioButton leftThumb
protected javax.swing.JRadioButton rightThumb
protected javax.swing.JRadioButton bothThumbs
protected javax.swing.JCheckBox[] chkBoxes
protected javax.swing.JTextField idField
protected javax.swing.JButton okButton
protected javax.swing.JButton cancelButton
Constructor Detail |
---|
public KeyLetterDialog(java.awt.Frame owner)
owner
- the frame to which this dialog is modal.public KeyLetterDialog(java.awt.Frame owner, java.lang.String mapping)
owner
- the frame to which this dialog is modal.mapping
- an existing mapping to use (i.e., one from a saved file).Method Detail |
---|
public void setMapping(java.lang.String mapping)
mapping
- the key-letter mapping to set.public void setVisible(boolean b)
setVisible
in class java.awt.Component
b
- pass true to show, false to hide.public void setVisible(boolean b, KeyButton key)
b
- pass true to show, false to hide.key
- pass null
for a new key, or
pass the object represeting an existing key to edit it.public void deleteKey(char keyID)
keyID
- the key whose mappings will be deleted.public char getKeyID()
public java.lang.String getChars()
public int getThumb()
KeyButton.LEFT_THUMB
,
KeyButton.RIGHT_THUMB
,
KeyButton.BOTH_THUMBS
public java.lang.String notMapped()
public java.lang.String getKeyMapping()
LETTERS
at the same index.
String
value of the variable keys
.public void actionPerformed(java.awt.event.ActionEvent ae)
actionPerformed
in interface java.awt.event.ActionListener
public void itemStateChanged(java.awt.event.ItemEvent e)
itemStateChanged
in interface java.awt.event.ItemListener
public void windowActivated(java.awt.event.WindowEvent we)
windowActivated
in interface java.awt.event.WindowListener
public void windowClosed(java.awt.event.WindowEvent we)
windowClosed
in interface java.awt.event.WindowListener
public void windowClosing(java.awt.event.WindowEvent we)
windowClosing
in interface java.awt.event.WindowListener
public void windowDeactivated(java.awt.event.WindowEvent we)
windowDeactivated
in interface java.awt.event.WindowListener
public void windowDeiconified(java.awt.event.WindowEvent we)
windowDeiconified
in interface java.awt.event.WindowListener
public void windowIconified(java.awt.event.WindowEvent we)
windowIconified
in interface java.awt.event.WindowListener
public void windowOpened(java.awt.event.WindowEvent we)
windowOpened
in interface java.awt.event.WindowListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |