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

ScrollPane AS_NEEDED always places scrollbars first time component is laid out

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 5.0
    • 1.1.6
    • client-libs
    • tiger
    • x86
    • windows_nt



      Name: bk70084 Date: 06/25/98


      The first time a scrollpane is added/becomes
      visible with SCROLLBARS_AS_NEEDED, it always uses
      both vertical and horizontal scrollbars.

      The following example creates a frame without a
      size. To demonstrate the bug, resize the frame
      so that the component gets laid out for the first
      time. Both scrollbars will appear. Another
      resize (larger or smaller) will exhibit proper
      behavior. If you resize to the smallest allowable,
      and then expand the frame again, the bug will
      repeat. The example demonstrates a problem I have
      in a much more complex application.

      Within my application, I have tried both
      doLayout() and validate() on the ScrollPane,
      it's Container, the top level Frame, to no avail.

      Code follows:
      -------------

      import java.awt.ScrollPane;
      import java.awt.Button;
      import java.awt.Frame;

      class ScrollPaneTest
        {
          public static void main( String[] args )
            {
              Frame f = new Frame();
              ScrollPane sp = new ScrollPane( ScrollPane.SCROLLBARS_AS_NEEDED );
              sp.add( new Button( "TEST" ) );
              f.add( "Center", sp );
              f.show();
            }
        }
      (Review ID: 34226)
      ======================================================================

            dmikhalksunw Denis Mikhalkin (Inactive)
            bklocksunw Brian Klock (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: