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

bug in BorderLayout or misleading documentation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P5 P5
    • 1.4.0
    • 1.3.0
    • docs
    • beta
    • sparc
    • solaris_2.6



      Name: skT45625 Date: 08/09/2000


      Solaris VM (build Solaris_JDK_1.2_01, native threads, sunwjit)


      Hi, the documentation for BorderLayout says:
      "A border layout lays out a container, arranging and resizing
       its components to fit in five regions: north, south, east,west, and center"

      I read it as "multiple components can be put into a single
      region". Yet, apparently the borderLayout can only handle
      5 components (one per region). Here is a sample code

       public class LayoutTest extends Frame {
             public LayoutTest() {
                 super("test");
                 setLayout(new BorderLayout());
                 add(new Button("North"), BorderLayout.NORTH);
                 add(new Button("South"), BorderLayout.SOUTH);
                 add(new Button("East"), BorderLayout.EAST);
                 add(new Button("East2"), BorderLayout.EAST);
                 add(new Button("West"), BorderLayout.WEST);
                 add(new Button("Center"), BorderLayout.CENTER);
             }
           public static void main(String[] args)
           {
               LayoutTest lt=new LayoutTest();
               lt.setSize(300,300);
               lt.setVisible(true);

           }
       }

      Only the "East2" button appears in the frame.
      This is either a bug or a misleading documentation..

      Have I missed something?
      Thanks,
      Ilya
      ###@###.###
      (Review ID: 108138)
      ======================================================================

            sharonz Sharon Zakhour (Inactive)
            skondamasunw Suresh Kondamareddy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: