/* BorderLayoutPanel.java */ import java.awt.*; /** * An extension of Panel that sets it to BorderLayout with convenience methods * that allow components to be set in the different parts of the layout. */ public class BorderLayoutPanel extends Panel { public BorderLayoutPanel( Container c ) { this.setLayout( new BorderLayout() ); c.add( this ); } // Methods for setting the contents of the BorderLayout. // Under Groovy, can access these in abbreviated property syntax, // like "bp.north=buttonpanel". public void setNorth( Component c ) { this.add(BorderLayout.NORTH, c); } public void setSouth( Component c ) { this.add(BorderLayout.SOUTH, c); } public void setEast( Component c ) { this.add(BorderLayout.EAST, c); } public void setWest( Component c ) { this.add(BorderLayout.WEST, c); } public void setCenter( Component c ) { this.add(BorderLayout.CENTER, c); } }