We have released version 2.1 of Java Virtual Keyboard component. It contains the following new features and improvements:
Automatic keyboard popupThe new KeyboardPopup utility provides declarative virtual keyboard auto-show capabilities for Java Swing applications. Using Swing's attached client properties, it enables the on-screen keyboard to automatically pop up when an input field receives focus and hide when focus leaves, with zero focus-listener boilerplate:
- AutoShow - enables or disables automatic popup display for the target component (or for all child components when set on a container).
- LayoutMode - specifies the keyboard layout (Default, Extended, Compact, Numeric3x4, or Numeric4x4) associated with the focused control.
- PopupPlacement - defines the popup position relative to the field (Bottom, Top, Left, Right, FormBottom, or ScreenBottom).
- CustomLayout - allows assigning a custom KeyboardLayout template to specific fields.
The popup uses a non-activating window architecture, ensuring that clicks on the virtual keyboard never steal focus or carets from the active text field.
// Enable automatic popup with Compact layout for all fields in the window
VirtualKeyboard.setAutoShow(this, true);
VirtualKeyboard.setLayoutMode(this, KeyboardMode.Compact);
// Assign specialized numeric layouts to specific input fields
VirtualKeyboard.setLayoutMode(txtUserID, KeyboardMode.Numeric3x4);
VirtualKeyboard.setLayoutMode(txtPhone, KeyboardMode.Numeric4x4);
New standard layoutsThree new built-in keyboard layouts have been added to the KeyboardMode enumeration and can be activated via the Mode property or retrieved as reusable KeyboardLayout templates:
- Compact – a streamlined layout without function keys (F1–F12) or redundant modifiers, ideal for mobile, touch, and compact popup windows.
- Numeric3x4 – a 3×4 telephone-style numeric keypad with 0–9 digits, Backspace, and Clear (C).
- Numeric4x4 – a 4×4 numeric keypad including 0–9, decimal point, minus sign, Backspace, Clear, Tab, and Enter.
// Select a layout mode directly
virtualKeyboard.setMode(KeyboardMode.Compact);
// Or use static factory methods for LayoutRing or TemplateLayout
KeyboardLayout layout = KeyboardLayout.compactLayout();
...
Miscellaneous- Added ClearKey class and static Key.CLEAR property to clear the contents of currently focused input controls.
- Automatic password detection: the auto-show popup automatically enables PasswordMode when the target field is a password box.
Distribution for the latest version can be downloaded here, or from the
clients area on our site:
https://mindfusion.dev/JKeyboard.zipUpdated JAR is also available at the Maven Central Repository:
https://search.maven.org/artifact/eu.mindfusion/keyboardEnjoy!