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

Control (Label,Text,Button) can not display Chinese characters

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 8
    • None
    • javafx

      code:
      ---------------------------------------------------------------

      package javafxapplication1;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.TextField;
      import javafx.scene.layout.VBox;
      import javafx.scene.text.Text;
      import javafx.stage.Stage;

      /**
       *
       * @author Administrator
       */
      public class JavaFXApplication1 extends Application {
          
          @Override
          public void start(Stage primaryStage) {
              primaryStage.setTitle("aaaa壹壹壹壹壹壹壹壹壹");
              primaryStage.setWidth(200);
              primaryStage.setHeight(100);
              VBox vBox = new VBox();

              Button btn = new Button("bbbbb贰贰贰贰贰贰贰贰贰贰贰贰");
              Text text = new Text("ccccc叁叁叁叁叁叁叁叁叁叁");
              //text.setFont(new Font("SimSun",12));
              TextField tf = new TextField("ddddd肆肆肆肆肆肆肆肆");
              vBox.getChildren().addAll(btn, text,tf);
              Scene scene = new Scene(vBox);
              primaryStage.setScene(scene);

              primaryStage.show();
          }

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


      -------------------------------------
      result:
      -------------------------------------

      The title of Stage is OK, but the Text/Button/TextField can not display the chinese charactar correctly.

      if invoking .setFont(new Font("SimSun",12)), the chinese charactars are OK.

            fheidric Felipe Heidrich (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: