Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Virtual Keyboard for Java Swing, V2.1 (Read 149 times)
Forum Admin
YaBB Administrator
*****
Offline


Rock and Roll

Posts: 766
Joined: Apr 6th, 2003
Virtual Keyboard for Java Swing, V2.1
Nov 4th, 2026 at 8:45am
Print Post  
We have released version 2.1 of Java Virtual Keyboard component. It contains the following new features and improvements:

Automatic keyboard popup
The 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.

Code
Select All
// 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 layouts
Three 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.

Code
Select All
// 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.zip

Updated JAR is also available at the Maven Central Repository:
https://search.maven.org/artifact/eu.mindfusion/keyboard

Enjoy!
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint