|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel com.jidesoft.swing.LabeledTextField com.jidesoft.shortcut.ShortcutField
public class ShortcutField
A LabeledTextField that is used to display Shortcut. You can use it to define KeyboardShortcut
or
MouseShortcut
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.jidesoft.swing.LabeledTextField |
---|
LabeledTextField.PopupMenuCustomizer |
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
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 | |
---|---|
protected KeyListener |
_keyListener
|
protected MouseListener |
_mouseListener
|
protected ChangeEvent |
changeEvent
|
static int |
TYPE_KEYBOARD
|
static int |
TYPE_MOUSE
|
Fields inherited from class com.jidesoft.swing.LabeledTextField |
---|
_button, _contextMenuKeyStroke, _customizer, _hintLabel, _hintText, _icon, _label, _labelText, _showHintTextWhenFocused, _textField |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
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 | |
---|---|
ShortcutField()
Creates a ShortcutField that supports both mouse and keyboard shortcut. |
|
ShortcutField(int allowedType)
Creates a ShortcutField. |
|
ShortcutField(int allowedType,
int type)
Creates a ShortcutField. |
Method Summary | |
---|---|
void |
addChangeListener(ChangeListener l)
Adds a ChangeListener to the model. |
void |
addKeyStroke(KeyStroke keyStroke)
Adds the KeyStroke. |
void |
clearShortcut()
Clears the existing Shortcut. |
protected String |
convertShortcutToString(Shortcut shortcut)
Converts the Shortcut instance to string to be displayed. |
protected JidePopupMenu |
createContextMenu()
Creates a context menu. |
protected KeyboardShortcut |
createKeyboardShortcut()
Creates an empty KeyboardShortcut. |
protected MouseShortcut |
createMouseShortcut()
Creates an empty MouseShortcut. |
protected void |
fireStateChanged()
Runs each ChangeListener 's stateChanged method. |
int |
getAllowedKeystrokes()
Gets the number of keystrokes allowed in this shortcut. |
int |
getAllowedType()
Gets the allowed shortcut type. |
ChangeListener[] |
getChangeListeners()
Returns an array of all the ChangeListener s added to this DefaultColorSelectionModel
with addChangeListener . |
int |
getMaximumAllowedKeystrokes()
Gets the maximum allowed keystrokes in a shortcut. |
Shortcut |
getShortcut()
Gets the shortcut. |
int |
getType()
Gets the current shortcut type. |
void |
removeChangeListener(ChangeListener l)
Removes a ChangeListener from the model. |
void |
setAllowedKeystrokes(int allowedKeystrokes)
Sets the number of keystrokes allowed in this shortcut. |
void |
setAllowedType(int allowedType)
Sets the allowed shortcut type. |
void |
setMaximumAllowedKeystrokes(int maximumAllowedKeystrokes)
Sets the the maximum allowed keystrokes in a shortcut. |
void |
setType(int type)
Sets the current shortcut type. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_KEYBOARD
public static final int TYPE_MOUSE
protected KeyListener _keyListener
protected MouseListener _mouseListener
protected transient ChangeEvent changeEvent
Constructor Detail |
---|
public ShortcutField()
public ShortcutField(int allowedType)
allowedType
- the allowed type. You can use TYPE_MOUSE, TYPE_KEYBOARD or TYPE_MOUSE | TYPE_KEYBOARD if you
want to support both.public ShortcutField(int allowedType, int type)
allowedType
- the allowed type. You can use TYPE_MOUSE, TYPE_KEYBOARD or TYPE_MOUSE | TYPE_KEYBOARD if you
want to support both.type
- the selected type. It could be either TYPE_MOUSE or TYPE_KEYBOARD. Please make sure you use
the type that is allowed. Otherwise you will get IllegalArgumentException.
IllegalArgumentException
- if type is not allowed.Method Detail |
---|
public int getType()
public void setType(int type)
type
- the new shortcut type.public int getAllowedType()
public void setAllowedType(int allowedType)
allowedType
- the allowed shortcut type. It could be either TYPE_MOUSE or TYPE_KEYBOARD. Please make sure
you use the type that is allowed. Otherwise you will get IllegalArgumentException.
IllegalArgumentException
- if type is not allowed.public int getMaximumAllowedKeystrokes()
public void setMaximumAllowedKeystrokes(int maximumAllowedKeystrokes)
maximumAllowedKeystrokes
- the maximum allowed keystrokes.public int getAllowedKeystrokes()
public void setAllowedKeystrokes(int allowedKeystrokes)
allowedKeystrokes
- the new number of keystrokes allowed in this shortcut. The number must be no greater
than getMaximumAllowedKeystrokes()
.protected JidePopupMenu createContextMenu()
LabeledTextField
createContextMenu
in class LabeledTextField
public void addKeyStroke(KeyStroke keyStroke)
getMaximumAllowedKeystrokes()
, it will clear all existing
KeyStrokes and add this new one. Otherwise it will append this new KeyStroke at the end. If you want this
KeyStroke to be the only one in the ShortcutField, you can use clearShortcut()
first, then call this
addKeyStroke.
keyStroke
- the KeyStroke to be added.protected KeyboardShortcut createKeyboardShortcut()
protected MouseShortcut createMouseShortcut()
protected String convertShortcutToString(Shortcut shortcut)
shortcut
- the Shortcut instance
public void clearShortcut()
public Shortcut getShortcut()
public void addChangeListener(ChangeListener l)
ChangeListener
to the model.
l
- the ChangeListener
to be addedpublic void removeChangeListener(ChangeListener l)
ChangeListener
from the model.
l
- the ChangeListener
to be removedpublic ChangeListener[] getChangeListeners()
ChangeListener
s added to this DefaultColorSelectionModel
with addChangeListener
.
ChangeListener
s added, or an empty array if no listeners have been addedprotected void fireStateChanged()
ChangeListener
's stateChanged
method.
EventListenerList
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |