-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
jfx11, jfx17, jfx18, jfx19
-
x86_64
-
linux
ADDITIONAL SYSTEM INFORMATION :
Oracle Linux 8 , Ubuntu 20.04
OpenJDK Runtime Environment Zulu18.30+11-CA (build 18.0.1+10)
(18.0.1.fx-zulu)
A DESCRIPTION OF THE PROBLEM :
Execute JavaFX Application, In the input field (JavaFX TextArea , JavaFX WebView(HTML TextArea)), cannot switch to Chinese input method to input Chinese characters.
Alternative solution, add the parameter -Djdk.gtk.version=2 when starting the program.
Execute JavaFX Application again,
(a) In the input field (JavaFX TextArea ) can switch to Chinese input method to input Chinese characters.
(b) In the input field (JavaFX WebView(HTML TextArea)), can switch to Chinese input method to input Chinese characters.
However, the Enter button cannot be entered to wrap a line, and whether the input method is switched in Chinese or English input state, the Enter button cannot be entered to wrap the line.
But JavaFX TextArea can enter the Enter key to wrap, only JavaFX WebView (HTML TextArea) cannot enter the Enter key to wrap
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Round 1
(1) java -jar JavaFXTextAreaWebViewApp.jar
(2) try to switch to Chinese input method , FAIL
Round 2
(1) java -Djdk.gtk.version=2 -jar JavaFXTextAreaWebViewApp.jar
(2) in JavaFX TextArea input field ,
2.1 switch to Chinese input method OK
2.2 input something OK
2.3 input ENTER key , new line OK
(3) in JavaFX WebView - HTML TextArea input field
3.1 switch to Chinese input method OK
3.2 input something OK
3.3 input ENTER ket , new line FAIL
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1. switch to Chinese input method OK
2. input something OK
3. input ENTER key , new line OK
ACTUAL -
(3) in JavaFX WebView - HTML TextArea input field
3.1 switch to Chinese input method OK
3.2 input something OK
3.3 input ENTER ket , new line FAIL
---------- BEGIN SOURCE ----------
---- TextAreaWebViewExample.java----
package com.demo.lab;
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.control.TextArea;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class TextAreaWebViewExample 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(TextAreaWebViewExample.class.getResourceAsStream(path)));
content = br.lines().collect(Collectors.joining());
primaryStage.setTitle("[JavaFX TextArea] And [JavaFX WebView - Html TextArea] Example");
WebView webView = new WebView();
WebEngine webEngine = null;
webEngine = webView.getEngine();
webEngine.loadContent(content, "text/html");
TextArea textArea = new TextArea();
textArea.setText("This is a JavaFX TextArea Component");
textArea.setFont(Font.font("Verdana", FontWeight.BOLD, 32));
VBox vBox = new VBox();
vBox.getChildren().add(textArea);
vBox.getChildren().add(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>
<h1 style="color: red; font-size: 32px;">This is WebView</h1>
<textarea name="mytext" rows="6" cols="60" required
style="color: blue; font-size: 32px;">
This is a JavaFX WebView Component
Load HTML - TextArea
</textarea>
</body>
</html>
---------- END SOURCE ----------
FREQUENCY : always
Oracle Linux 8 , Ubuntu 20.04
OpenJDK Runtime Environment Zulu18.30+11-CA (build 18.0.1+10)
(18.0.1.fx-zulu)
A DESCRIPTION OF THE PROBLEM :
Execute JavaFX Application, In the input field (JavaFX TextArea , JavaFX WebView(HTML TextArea)), cannot switch to Chinese input method to input Chinese characters.
Alternative solution, add the parameter -Djdk.gtk.version=2 when starting the program.
Execute JavaFX Application again,
(a) In the input field (JavaFX TextArea ) can switch to Chinese input method to input Chinese characters.
(b) In the input field (JavaFX WebView(HTML TextArea)), can switch to Chinese input method to input Chinese characters.
However, the Enter button cannot be entered to wrap a line, and whether the input method is switched in Chinese or English input state, the Enter button cannot be entered to wrap the line.
But JavaFX TextArea can enter the Enter key to wrap, only JavaFX WebView (HTML TextArea) cannot enter the Enter key to wrap
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Round 1
(1) java -jar JavaFXTextAreaWebViewApp.jar
(2) try to switch to Chinese input method , FAIL
Round 2
(1) java -Djdk.gtk.version=2 -jar JavaFXTextAreaWebViewApp.jar
(2) in JavaFX TextArea input field ,
2.1 switch to Chinese input method OK
2.2 input something OK
2.3 input ENTER key , new line OK
(3) in JavaFX WebView - HTML TextArea input field
3.1 switch to Chinese input method OK
3.2 input something OK
3.3 input ENTER ket , new line FAIL
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1. switch to Chinese input method OK
2. input something OK
3. input ENTER key , new line OK
ACTUAL -
(3) in JavaFX WebView - HTML TextArea input field
3.1 switch to Chinese input method OK
3.2 input something OK
3.3 input ENTER ket , new line FAIL
---------- BEGIN SOURCE ----------
---- TextAreaWebViewExample.java----
package com.demo.lab;
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.control.TextArea;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class TextAreaWebViewExample 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(TextAreaWebViewExample.class.getResourceAsStream(path)));
content = br.lines().collect(Collectors.joining());
primaryStage.setTitle("[JavaFX TextArea] And [JavaFX WebView - Html TextArea] Example");
WebView webView = new WebView();
WebEngine webEngine = null;
webEngine = webView.getEngine();
webEngine.loadContent(content, "text/html");
TextArea textArea = new TextArea();
textArea.setText("This is a JavaFX TextArea Component");
textArea.setFont(Font.font("Verdana", FontWeight.BOLD, 32));
VBox vBox = new VBox();
vBox.getChildren().add(textArea);
vBox.getChildren().add(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>
<h1 style="color: red; font-size: 32px;">This is WebView</h1>
<textarea name="mytext" rows="6" cols="60" required
style="color: blue; font-size: 32px;">
This is a JavaFX WebView Component
Load HTML - TextArea
</textarea>
</body>
</html>
---------- END SOURCE ----------
FREQUENCY : always
- duplicates
-
JDK-8286831 WebView can't switch to Chinese input method in GTK3
-
- Open
-