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

JScrollPane fails to reshow scrollbars on window resizes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 1.3.0
    • 1.1.7, 1.2.0, 1.2.1, 1.2.2
    • client-libs
    • beta
    • generic, x86, sparc
    • generic, solaris_2.6, windows_95, windows_nt

    Description



      Name: vi73552 Date: 06/03/99


      A frame with 3 JLists is popped up , it shows scrollbars
      Drag the corner of the Frame to resize it (make it bigger)
      so that ScrollBars do not show.
      Now drag the same corner of the frame to resize it (make it smaller)
      to the previous size that presented scrollbars.
      Scrollbars are missing in all three JLists even though they are needed
      because not all items are visible.
      Now any subsequent Frame resizes will make the scrollbars visible
      again.


      import javax.swing.*;
      import java.awt.*;
      import javax.swing.border.*;
      public class a extends JPanel
      {
         public a()
                {
              super(new BorderLayout());
              setBorder(new EmptyBorder(new Insets(5,5,5,5)));

                                      String [] arr = new String [] {"item 1","item 2","item 3",
                                           "item 4","item 5","item 6",
                                           "item 7","item 8","item 9","item 10","item 11"
              };

              JPanel hContentPane = new JPanel();
              hContentPane.setLayout(new BoxLayout(hContentPane,BoxLayout.X_AXIS));
              JPanel vContentPane = new JPanel();
              vContentPane.setLayout(new BoxLayout(vContentPane,BoxLayout.Y_AXIS));

              hContentPane.add(
                createBorderPanel(new JList(arr),"Added ")
                );

              hContentPane.add(
                createBorderPanel(new JList(arr),"Removed ")
                );
              vContentPane.add(hContentPane);

              vContentPane.add
                (
                  createBorderPanel(new JList(arr),"Errors")
                );
              
              add(vContentPane,BorderLayout.CENTER);

              setPreferredSize(new Dimension(500,300));
            }

          private JPanel createBorderPanel(JList list, String title)
            {
              JPanel panel = new JPanel(new BorderLayout());
              panel.setBorder(new CompoundBorder(
                new TitledBorder(
                  new SoftBevelBorder(BevelBorder.RAISED),title),
                new EmptyBorder(new Insets(0,0,0,0))));

              panel.add(new JScrollPane(list),BorderLayout.CENTER);
              return panel;
            }

         public static void main(String [] args)
         {
             JFrame f = new JFrame();
             f.setContentPane(new a());
             f.pack();
             f.setVisible(true);
         }
      }
      (Review ID: 83869)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              svioletsunw Scott Violet (Inactive)
              vasya Vassili Igouchkine (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: