public class VirtualKeyboard
extends javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
VirtualKeyboard()
Initializes a new instance of the VirtualKeyboard class.
|
Modifier and Type | Method and Description |
---|---|
void |
addVirtualKeyboardListener(VirtualKeyboardListener listener)
Registers listener so that it will receive events when users press keyboard keys.
|
void |
applyTheme(java.io.InputStream stream)
Applies a theme to the keyboard and its keys.
|
void |
applyTheme(java.lang.String fileName)
Applies a theme to the keyboard and its keys.
|
void |
dispose() |
static boolean |
getAltGrLocked()
Gets the state of the AltGr key.
|
static boolean |
getAltLocked()
Gets the state of the Alt key.
|
boolean |
getAutoFill()
Gets whether keyboard layout should be generated automatically depending
on the language (e.g.
|
boolean |
getAutoReleaseModifierKeys()
Gets whether pressing a regular key automatically releases modifier keys
such as shift, alt, control etc.
|
boolean |
getAutoRepeat()
Gets whether the component should synthesize keyboard events repeatedly when
a virtual key is pressed down, until the key is released.
|
static boolean |
getCapsLocked()
Gets the state of the Caps-lock key.
|
static boolean |
getControlLocked()
Gets the state of the Control key.
|
KeyboardLayout |
getDefaultLayout()
Gets the default keyboard layout.
|
java.util.Locale |
getInputLocale()
Gets the current input language.
|
KeyTemplate |
getKeyTemplate()
Gets the appearance of key buttons.
|
java.lang.String |
getLayoutsFolder()
Gets the folder where layout files are located.
|
KeyboardMode |
getMode()
Gets the layout mode.
|
static boolean |
getNumLocked()
Gets the state of the Num-lock key.
|
int |
getRepeatDelay()
Specifies the initial delay in milliseconds before the component
starts repeating key-down events when AutoRepeat is enabled.
|
boolean |
getRepeatDownOnly()
Gets whether keys repeat only key-down events, with a single key-up generated in the end.
|
int |
getRepeatRate()
Gets the delay in milliseconds between consecutive key-down events synthesized in AutoRepeat mode.
|
static boolean |
getScrollLocked()
Gets the state of the Scroll-lock key.
|
static boolean |
getShiftLocked()
Gets the state of the Shift key.
|
boolean |
getStandalone()
Gets whether the keyboard is the only content of the application's window.
|
KeyboardLayout |
getTemplateLayout()
Gets the keyboard's layout template.
|
Theme |
getTheme()
Gets the keyboard appearance theme.
|
void |
loadImeTable(java.util.Locale locale,
java.lang.String filePath)
Loads an IME table file for specified locale.
|
void |
paintComponent(java.awt.Graphics graphics)
JComponent.paintComponent override.
|
void |
removeVirtualKeyboardListener(VirtualKeyboardListener listener)
Unregisters listener so that it will no longer receive keyboard events.
|
void |
sendKey(Key objKey)
Sends the specified key input to active window.
|
void |
setAutoFill(boolean value)
Sets whether keyboard layout should be generated automatically depending
on the language (e.g.
|
void |
setAutoReleaseModifierKeys(boolean value)
Sets whether pressing a regular key automatically releases modifier keys
such as shift, alt, control etc.
|
void |
setAutoRepeat(boolean value)
Sets whether the component should synthesize keyboard events repeatedly when
a virtual key is pressed down, until the key is released.
|
void |
setDefaultLayout(KeyboardLayout value)
Sets the default keyboard layout.
|
void |
setFont(java.awt.Font value)
JComponent.setFont override.
|
void |
setInputLocale(java.util.Locale value)
Sets the current input language.
|
void |
setKeyTemplate(KeyTemplate value)
Sets the appearance of key buttons.
|
void |
setLayoutsFolder(java.lang.String value)
Sets the folder where layout files are located.
|
static void |
setLicenseKey(java.lang.String licenseKey)
Sets the component's license key string, disabling evaluation mode.
|
void |
setMode(KeyboardMode value)
Sets the layout mode.
|
void |
setRepeatDelay(int value)
Specifies the initial delay in milliseconds before the component
starts repeating key-down events when AutoRepeat is enabled.
|
void |
setRepeatDownOnly(boolean value)
Sets whether keys repeat only key-down events, with a single key-up generated in the end.
|
void |
setRepeatRate(int value)
Sets the delay in milliseconds between consecutive key-down events synthesized in AutoRepeat mode.
|
void |
setStandalone(boolean value)
Sets whether the keyboard is the only content of the application's window.
|
void |
setTemplateLayout(KeyboardLayout value)
Sets the keyboard's layout template.
|
void |
setTheme(Theme value)
Sets the keyboard appearance theme.
|
void |
unlockKeys()
Unlocks all modifier keys.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public VirtualKeyboard()
public void dispose()
public void setLayoutsFolder(java.lang.String value)
value
- A String specifying the location of locale-specific layout files
used when KeyboardMode
is set to Custom
.public java.lang.String getLayoutsFolder()
public void setAutoFill(boolean value)
value
- true to automatically fill regular character keys, or false otherwise.public boolean getAutoFill()
public void setTheme(Theme value)
value
- A member of the Theme
enumeration.public Theme getTheme()
Theme
enumeration.public void setKeyTemplate(KeyTemplate value)
value
- An instance of the KeyTemplate
class.public KeyTemplate getKeyTemplate()
KeyTemplate
class.public void setAutoReleaseModifierKeys(boolean value)
value
- true to release modifiers automatically, or false otherwise.public boolean getAutoReleaseModifierKeys()
public void setDefaultLayout(KeyboardLayout value)
value
- An instance of the KeyboardLayout
class.public KeyboardLayout getDefaultLayout()
KeyboardLayout
class.public void setTemplateLayout(KeyboardLayout value)
value
- An instance of the KeyboardLayout
class.public KeyboardLayout getTemplateLayout()
KeyboardLayout
class.public void setMode(KeyboardMode value)
value
- A member of the KeyboardMode
enumeration.public KeyboardMode getMode()
KeyboardMode
enumeration.public void setStandalone(boolean value)
value
- true if the application acts only as virtual keyboard,
or false if used as embedded keyboard.public boolean getStandalone()
public void setInputLocale(java.util.Locale value)
value
- An instance of the java.util.Locale class.public java.util.Locale getInputLocale()
public void unlockKeys()
public void setFont(java.awt.Font value)
setFont
in class javax.swing.JComponent
public void applyTheme(java.io.InputStream stream)
stream
- A Stream from which to load theme attributes.public void applyTheme(java.lang.String fileName)
fileName
- The file from which to load theme attributes.public void paintComponent(java.awt.Graphics graphics)
paintComponent
in class javax.swing.JComponent
public static void setLicenseKey(java.lang.String licenseKey)
licenseKey
- A string value containing encoded license information.public void sendKey(Key objKey)
objKey
- An instance of Key
-derived class.public void loadImeTable(java.util.Locale locale, java.lang.String filePath)
locale
- java.util.Locale instance specifying the locale.filePath
- Path to the dictionary file or folder.public static boolean getShiftLocked()
public static boolean getControlLocked()
public static boolean getAltLocked()
public static boolean getAltGrLocked()
public static boolean getNumLocked()
public static boolean getScrollLocked()
public static boolean getCapsLocked()
public void addVirtualKeyboardListener(VirtualKeyboardListener listener)
listener
- An object implementing the VirtualKeyboardListener
interface.public void removeVirtualKeyboardListener(VirtualKeyboardListener listener)
listener
- An object implementing the VirtualKeyboardListener
interface.public boolean getAutoRepeat()
public void setAutoRepeat(boolean value)
value
- true to enable automatic repeat, or false otherwise. The default value is true.public int getRepeatDelay()
public void setRepeatDelay(int value)
value
- An integer value specifying initial delay in milliseconds. The default value is 500.public int getRepeatRate()
public void setRepeatRate(int value)
value
- An integer value specifying delay in milliseconds. The default value is 20.public boolean getRepeatDownOnly()
public void setRepeatDownOnly(boolean value)
value
- true if repeating only key-down events, or false if repeating down/up events in pairs.