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

Text component resizes when mouse is moved

XMLWordPrintable

    • b25
    • x86
    • linux



      Name: dmR10075 Date: 08/20/2003



      Run the following test case. You will see two text panes inside the
      frame. Remove some text from the lower pane(leave one line). Move mouse
      from outside/inside this pane. Eventually the panes will be resize so
      that lower pane becomes smaller. Add some text to lower pane, repeat
      mouse moves - lower pane will become bigger.

      I noticed that JTabbedPane is important for the test to fail. Without it
      nothing bad happens.

      The bug was reproduced on Linux using 1.5.0b15.

      import javax.swing.*;
      import java.awt.*;

      public class TestTextAreaResize {

          public static void main(String[] args) {
              JFrame f = new JFrame("Test frame");
              f.getContentPane().setLayout(new BoxLayout(f.getContentPane(),
      BoxLayout.Y_AXIS));
              Container cont = f.getContentPane();

              Container dbReportPanel = new JPanel();
              dbReportPanel.setLayout(new BorderLayout());
              cont.add(dbReportPanel);

              JTabbedPane mainPane = new JTabbedPane();
              mainPane.add("DB Report", dbReportPanel);
              
              cont.add(mainPane, BorderLayout.CENTER);

              Container headerCont = new Container();
              headerCont.add(new JLabel("Header"));

              Container centerCont = new Container();
              centerCont.setLayout(new BoxLayout(centerCont,
      BoxLayout.Y_AXIS));
              dbReportPanel.add(centerCont, BorderLayout.CENTER);
              dbReportPanel.add(headerCont, BorderLayout.SOUTH);

              Container cont1 = new Container();
              cont1.setLayout(new BorderLayout());
              centerCont.add(cont1);
              cont1.add(new JLabel("Label1"), BorderLayout.NORTH);
              cont1.add(new JScrollPane(new JTextArea("Container cont1 = new
      Container();\n" +
                                                      "cont1.setLayout(new
      BorderLayout());\n" +
                                                     
      "centerCont.add(cont1);")));

              Container cont2 = new Container();
              cont2.setLayout(new BorderLayout());
              centerCont.add(cont2);
              cont2.add(new JLabel("Label2"), BorderLayout.NORTH);
              cont2.add(new JScrollPane(new JTextArea("Container cont1 = new
      Container();\n" +
                                                      "cont1.setLayout(new
      BorderLayout());\n" +
                                                     
      "centerCont.add(cont1);")));
              
              f.pack();
              f.setVisible(true);

          }
      }


      ======================================================================

            svioletsunw Scott Violet (Inactive)
            domsunw Dom Dom (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: