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

TextField.setText breaks the contract of EOL

XMLWordPrintable

    • b140

      According to change: "8145284: [Documentation] [TextField] Missing new line character handling"

      "If {@code text} contains EOL character, then it will be replaced by space character."

      EOL as defined by Java (System.lineSeparator()) is :

       * <p>On UNIX systems, it returns "\n" and on Microsoft Windows systems it returns "\r\n".

      Running the below mentioned code on Windows machine, should not provide a space as "\n" is not a valid EOL for Windows.

      String text = "line1";
              String text1 = "line2";
              if(System.getProperty("os.name").contains("Win")) {
                  TextField textField = new TextField(text + "\n" + text1);
                  System.out.println(textField.getText());
              }

      If this has been done for the native level simulation, the spec need to change accordingly. It has to mention "EOL" and "\n" (For windows)

            arapte Ambarish Rapte
            vaibhav Vaibhav Choudhary (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: