Windows tablet touch keyboard does not open when text field is focused
When focus is received in TextField
, the touchscreen keyboard does not appear.
I suppose because the JavaFx app doesn't support Metro?
I find a way to pop up on the keyboard:
public class Controller {
public static void showVirtualKeyboard(
ObservableValue<? extends Boolean> observable,
Boolean oldState,
Boolean hasFocus )
{
if( hasFocus ) {
try {
Runtime.getRuntime().exec(
"cmd /c \"C:\\Program Files\\Common Files\\microsoft " +
"shared\\ink\\tabtip.exe\"" );
}
catch( final Throwable t ) {
LogHelper.severe( t );
}
}
}
}
In any view:
final class VisualAnalysis extends GridPane implements IView {
private final TextField tech = new TextField();
@Override
public void setController( Controller ctrl ) {
...
tech.focusedProperty().addListener( Controller::showVirtualKeyboard );
}
This is a workaround. Have you found a better way?
+3
source to share
1 answer
This is a cool way to show Windows native virtual keyboard (which I find much better than JavaFX).
Did the app run the app with VM arguments
-Dcom.sun.javafx.isEmbedded=true
-Dcom.sun.javafx.virtualKeyboard=javafx
The latter should also take the "native" parameter, but it also renders the JavaFX keyboard for me. So for explicitly displaying the Windows keyboard, I'm looking for some help myself :)
+1
source to share