Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8286831

WebView can't switch to Chinese input method in GTK3

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • jfx11, 8u281, jfx17, jfx18, jfx19
    • javafx

      ADDITIONAL SYSTEM INFORMATION :
      Oracle Linux 8, Ubuntu 20.04 , Zulu 18.0.1.fx-zulu , 17.0.3.fx-zulu (OpenJDK + JavaFX)

      A DESCRIPTION OF THE PROBLEM :
      JavaFX Application include WebView, WebView Html Include TextArea,
      (1) Web HTML Include HTML TextArea
      By Default, I can not switch to Chinese Input method to input some chinese char。
      But , I add start parameter -Djdk.gtk.version=2,
      I can switch to Chinese Input method to input some chinese char。
      But, I can not enter 'ENTER' to TextArea, even I switch to english input method IME.
      (2) JavaFX Component TextArea
      I test JavaFX Application include TextArea , after add start parameter -Djdk.gtk.version=2,
      I can switch to Chinese Input method to input some chinese char。
      And I can enter 'ENTER' to TextArea。

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      java JavaFXWebViewApp.jar

      java -Djdk.gtk.version=2 -jar JavaFXWebViewApp.jar

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Can switch to Chinese Input method , and input chinese char , and input ENTER key
      ACTUAL -
      Can not switch to Chinese input method
      or
      Can Switch to Chinese input method and input Chinese Char, But can not input ENTER KET

      ---------- BEGIN SOURCE ----------
      import java.io.BufferedReader;
      import java.io.IOException;
      import java.io.InputStreamReader;
      import java.util.stream.Collectors;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.layout.VBox;
      import javafx.scene.web.WebEngine;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;

      public class WebViewExample extends Application {

          public static void main(String[] args) {
              launch(args);
          }

          public void start(Stage primaryStage) throws IOException {
      String content="";
      String path="index.html";
      BufferedReader br = new BufferedReader(new InputStreamReader(WebViewExample.class.getResourceAsStream(path)));
      content = br.lines().collect(Collectors.joining());
           
             primaryStage.setTitle("JavaFX WebView Example");

              WebView webView = new WebView();
              WebEngine webEngine = null;
              webEngine = webView.getEngine();
              webEngine.load("http://google.com");
              
             // String content = "Hello World!";
              webEngine.loadContent(content, "text/html");
              VBox vBox = new VBox(webView);
              Scene scene = new Scene(vBox, 960, 600);

              primaryStage.setScene(scene);
              primaryStage.show();

          }
      }
      ---index.html--------------
      <!DOCTYPE html>
      <html lang="zh-hant" >
      <head>
      <meta charset="utf-8">
      <title>Test JavaFX WebView TextArea</title>
      </head>
      <body>
      <textarea name="mytext"
                rows="6"
                cols="40"
                required>
      Please input chinese char and press enter key
      </textarea>
      </body>
      </html>


      ---------- END SOURCE ----------

        1. index.html
          0.3 kB
          Praveen Narayanaswamy
        2. WebViewExample.java
          1 kB
          Praveen Narayanaswamy

            jbhaskar Jay Bhaskar
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: