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

Broken JScrollPane in Swing (JFC) 0.6.1

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.2.0
    • 1.1.4
    • client-libs
    • swing0.7
    • sparc
    • solaris_2.5.1



      Name: diC59631 Date: 12/04/97


      The swing 0.6.1 JScrollPane is broken.
      Specifically, the scroll bars are brought
      up when a component which is smaller than the
      viewport is put in the scrollpane, and the
      scrollpane is resized smaller. The 0.5.1 code
      which worked is listed below. 0.6.1 breaks it.

      To see the effect, compile the following under
      both 0.5.1 and 0.6.1. When run you will get a
      window with a scrolled pane which contains a
      simple "Hello World." button. Dragging the
      window larger seems to be okay, but shrinking
      the window in 0.6.1 causes scrollbars to appear
      with no thumb visible. Weird.

      -------- CUT HERE --------

      import java.awt.*;
      import com.sun.java.swing.*;

      public class Scroller
      {
        public static void main(String argv[])
        {
          Frame application = new Frame("Scroller");

          JScrollPane scroller =
              new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                              ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

          JButton button = new JButton("Hello World.");

          application.add("Center",scroller);

          application.setSize(640,480);
          application.show();

          scroller.getViewport().add(button);
        }
      }
      (Review ID: 21296)
      ======================================================================

            sswingtrsunw Swingtraq Swingtraq (Inactive)
            dindrigo Daniel Indrigo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: