简体   繁体   English

当文本域聚焦时,Windows平板电脑触摸键盘不会弹出

[英]Windows tablet touch keyboard doesn't popup when textfield focused

When focus is gained into a TextField , the touch screen keyboard doesn't appear. 当焦点进入TextField ,触摸屏键盘不会出现。

I suppose it's because a JavaFx Application isn't Metro compliant? 我想这是因为JavaFx应用程序不符合Metro标准?

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). 这是显示Windows本机虚拟键盘的一种很酷的方式(我觉得它比JavaFX更好)。

Have you run the application with with the VM arguments 您是否使用VM参数运行应用程序

-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. 最后一个也应该采用参数'native',但它也为我显示了JavaFX键盘。 So for explicitly showing the Windows keyboard I'm looking for some help myself :) 所以为了明确显示Windows键盘,我正在寻找一些帮助自己:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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