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

the width of <select></select> widget changes based the line's available space

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.3.0
    • client-libs
    • beta
    • x86, sparc
    • solaris_2.6, windows_nt
    • Verified



      Name: skT45625 Date: 04/03/2000


      java version "1.3.0rc2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc2-Y)
      Java HotSpot(TM) Client VM (build 1.3.0rc2-Y, mixed mode)


      (related to #4232716)

      When HTMLEditorKit creates a view representing a <select size=1> element, the
      initial size of the resulting widget is chosen in such a way as to fill up the
      entire available space of the current line. Later if the size of the line is
      to change, the width of the dropdown changes too.

      Admittedly, the HTML spec doesn't define the heuristics for determining the
      width of a 'select' element. Still, it's my opinion that once set, the width
      shouldn't change.

      Steps to reproduce:

      1. Compile and run included code
      2. Resize the applet window
         the size of the combo box will change
         with the size of the applet window

      import java.awt.*;
      import java.awt.datatransfer.*;
      import java.util.*;
      import javax.swing.*;
      import javax.swing.text.*;
      import javax.swing.text.html.*;

      public class test extends JPanel
      {
         private JEditorPane html;

         public static void main( String args[] )
         {
            JFrame frame = new JFrame("Test");
            frame.setContentPane( new test() );
            frame.setBounds(100,100,300,200);
            frame.show();
         }

         public test()
         {
            html = new JEditorPane();
            html.setEditorKit( new HTMLEditorKit() );
            
            html.setText("<p>Count: <select
      size=1><option>1</option><option>2</option> items?</p>");
            setLayout( new BorderLayout() );
            add( html, BorderLayout.CENTER );
            
       }
        
      }
      (Review ID: 103171)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            skondamasunw Suresh Kondamareddy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: