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

JEditorPane HTML form with multi-selection broke data after resetting

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8, 11, 17, 19
    • client-libs
    • None
    • Fix Understood

      When JEditorPane shown HTML multi-selection form, a reset operation broke its drawing.

      Recreate steps:
      1. Select item 4.
      2. Push the reset button
      3. Move focus to other application
      4. Move focus back to this sample
      => Item 2 was selected.
      -------
      import java.awt.BorderLayout;
      import javax.swing.JEditorPane;
      import javax.swing.JFrame;

      public class ResetSelectForm {
          public static void main(String[] args) throws Exception {
              JEditorPane html = new JEditorPane("text/html",
                      "<html><body><form action=\"http://localhost.cgi\">" +
                      "<select name=select id=\"mySelect\" size=\"5\" multiple> \n" +
                      " <option>1</option> \n" +
                      " <option>2</option> \n" +
                      " <option>3</option> \n" +
                      " <option>4</option> \n" +
                      " <option>5</option> \n" +
                      "</select> " +
                      "<br>" +
                      "<input type=reset name=reset value=\"reset\"/>" +
                      "<br>" +
                      "<input type=submit name=submit value=\"submit\"/>" +
                      "</form></body></html>");
              JFrame frame = new JFrame();
              frame.setSize(200, 200);
              frame.setLayout(new BorderLayout());
              frame.add(html, BorderLayout.CENTER);
              frame.setVisible(true);
          }
      }

            tnakamura Toshio Nakamura
            tnakamura Toshio Nakamura
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: