When focus is gained into a TextField
, the touch screen keyboard doesn't appear.
I suppose it's because a JavaFx Application isn't Metro compliant?
I find a way to pop up 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 );
}
It's a workaround. Have you discover a better way?
This is a cool way to show the Windows native virtual keyboard (which I feel is much better than the JavaFX one).
Have you run the application with with the VM arguments
-Dcom.sun.javafx.isEmbedded=true
-Dcom.sun.javafx.virtualKeyboard=javafx
The last one should also take the parameter 'native' but it also shows the JavaFX keyboard for me. So for explicitly showing the Windows keyboard I'm looking for some help myself :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With