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

Scrollbars work incorrectly when resizing a window.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.2.0, 1.2.2
    • client-libs
    • x86, sparc
    • solaris_7, windows_nt

      Scroll bars don't seem to be working correctly with a JTextArea.


      Name: gsC80088 Date: 03/14/99


      I added a JScrollPane that contains a JEditorPane to a JFrame.
      When I resized the window to make it longer and shrunk it back
      up again, the horizontal scroll bar showed up.

      At the bottom is some code to show what the problem is. Compile
      this code and resize the window to be about 750 by 150 (doesn't
      matter too much). Then resize it back to 150 by 150. You'll notice
      that the horiztonal scroll bar appeared at the bottom, even though
      you don't have text appearing to cause the scroll bar.

      The cause of the problem is basically the width size of the
      JEditorPane will remain whatever the biggest width the window
      ever was. NOTE: this does not happen in ther vertical direction.

      BTW: For those of you who went to Cal Poly a couple of weeks ago,
      (Jeff, Mark, etc.), thanks for coming. I appreciated talking with
      you.
      Also, is there a forum I can look up to find wherever there might
      be known bugs for particular classes?

      Michael

      import java.awt.Dimension;

      import javax.swing.JFrame;
      import javax.swing.JEditorPane;
      import javax.swing.JScrollPane;

      public class TestFrame extends JFrame
      {
         public class NewEditorPane extends JEditorPane
         {
            public Dimension getSize()
            {
               Dimension dim = super.getSize();
               System.out.println("size: " + dim.width + " " + dim.height);
               return dim;
            }
         }

         public TestFrame()
         {
            getContentPane().add(new JScrollPane(new NewEditorPane()));
         }

         public static void main(String args[])
         {
            TestFrame mainFrame = new TestFrame();

            mainFrame.setVisible(true);
         }
      }
      ======================================================================

            idk Igor Kushnirskiy (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: