简体   繁体   中英

Windows tablet touch keyboard doesn't popup when textfield focused

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 :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM