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

Choice components in GridLayout don't fill entire cells.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.1.2
    • client-libs
    • None
    • sparc
    • generic

      When placing a Choice component into a GridLayout layout manager, the Choice component does not fill the entire cell it is allocated in the GridLayout. This is contrary to what the Java tutorial (p. 423) says. I can't find a definite answer on how the GridLayout should work, other than in the tutorial.

      When placing a button inside a GridLayout, it occupies the full cell.

      The problem occurs with JDK 1.1, 1.1.1, and 1.1.2.
      --------------------------------------------------------------------------------
      Application to reproduce the problem:

      import java.awt.*;
      import java.awt.event.*;

      public class GridChoiceBug extends Frame implements WindowListener
      {
      Choice c1;
      public GridChoiceBug()
      {

      super("Test Dialog Layout Manager");
      addNotify();
      Insets insets = getInsets();
      setSize( insets.left + 400 + insets.right, insets.top + 400 +
                      insets.bottom );
                      setLayout(new GridLayout(1,1));

      c1 = new Choice();
      c1.addItem("One");
      add( c1 );

           addWindowListener(this);
      validate();
      show();
      }
         public void windowClosed(WindowEvent event) {}
         public void windowDeiconified(WindowEvent event) {}
         public void windowIconified(WindowEvent event) {}
         public void windowActivated(WindowEvent event) {}
         public void windowDeactivated(WindowEvent event) {}
         public void windowOpened(WindowEvent event) {}
         public void windowClosing(WindowEvent event)
         {
      System.exit(0);
         }

      public static void main(String args[])
      {
      new GridChoiceBug();
      }
      }

      creighton.chong@eng 1997-11-21

            dmendenhsunw David Mendenhall (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: