Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.4.2
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      mantis
    • CPU:
      x86
    • OS:
      windows_nt, windows_2000

      Description



      Name: bsC130419 Date: 06/04/2001


      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)


      If pack() is not called or the frame is in iconified state before calling
      setVisible(true) all components in the frame are drawn at wrong positions,
      extra space is added at the top and left.
      If pack is called after setVisible(true) extra space is added at the right.

      Here is some source code demonstrating the problem, try clicking just above
      the "N" button in the 2nd or 4th frame.

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

      public class Main extends JFrame
      {
          public Main(boolean packit, boolean hideAndShow, boolean packLater,int x)
          {
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      Container con = getContentPane();
      con.setLayout(new BorderLayout());

      con.add(new JButton("N"), BorderLayout.NORTH);
      con.add(new JButton("W"), BorderLayout.WEST);
      con.add(new JButton("E"), BorderLayout.EAST);
      con.add(new JButton("S"), BorderLayout.SOUTH);

      if (hideAndShow) setState(ICONIFIED);
      setLocation(x, 200);
      if (packit) pack();
      setVisible(true);
      if (hideAndShow) setState(NORMAL);
      if (packLater) pack();
          }
          public static void main(String[] args)
          {
              Main main0 = new Main(true, true, true, 100);
              Main main1 = new Main(false, false, false, 250); // broken
              Main main2 = new Main(true, false, false, 400); // this one is ok
              Main main3 = new Main(true, true, false, 550); // broken
              Main main4 = new Main(false, false, true, 700);
          }
      }
      (Review ID: 125709)
      ======================================================================

      Name: yyT116575 Date: 06/06/2001


      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
      Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)

      /* In the following program the layout of the components is totally messed up. If you uncomment the call to pack(), everything works fine. This wasn't the case in 1.3. */

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

      class SelectionTest extends JFrame {

        /**
         * Constructor.
         */
        public SelectionTest() {

          getContentPane().setLayout(new BorderLayout());

          getContentPane().add(new JButton("Test"), BorderLayout.NORTH);
          getContentPane().add(new JTextArea("Test"), BorderLayout.SOUTH);
        }

        public static void main(String[] args) {

          SelectionTest test = new SelectionTest();

      // test.pack();
          test.setVisible(true);
        }
      }
      (Review ID: 125956)
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              son Oleg Sukhodolsky (Inactive)
              Reporter:
              bstrathesunw Bill Strathearn (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: