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

Swing JOptionPane shows </html> tag as a string after newline

XMLWordPrintable

    • b22
    • generic, x86
    • solaris_2.5, windows_xp

      For example, in the code snippet below: I do something like this

             String Message = "<html>" + "This is a test\n" + "</html>";
                 JOptionPane dialog = new JOptionPane();
                 dialog.setMessage(Message);
                 dialog.setMessageType(JOptionPane.INFORMATION_MESSAGE);
                 dialog.setOptions(buttons);
                 dialog.setOptionType(JOptionPane.DEFAULT_OPTION);
                 dialog.setInitialValue(buttons[0]);

      When the dialog is displayed, it showed:
      "This is a test
      </html>"

      Now, if I don't have a linefeed "\n" (or tab "\t") in my message, this it's okay.
      The dialog will display "This is a test"

      So, the problem here is that "</html> is display in the GUI dialog box.

      Is this a known issue? I tried this with both JDK 1.4 and 1.5 beta3 and the symptom is the same.
      ###@###.### 2004-07-14
      ###@###.### 2004-07-14
      A long html message will also be broken up into multiple lines if the method JOptionPane.getMaxCharactersPerLineCount() is overridden to return a limiting value. The first line is then formatted correctly, but subsequent lines show raw html tags.

            psadhukhan Prasanta Sadhukhan
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: