AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YDAT | YWAIT | Byzgraf | FAQs
BorderLayout typedict
 
A BorderLayout is a layout manager that arranges the components in a container based on a positioning constraint that follows each component in the container's layout array. Components should be AWT or Swing components, however all layout managers build a label appropriate for the container they are working on when they find a String in the layout array where they expected a component. Properties, like the font or foreground color, used by these short-hand labels can not be directly specified, so they are inherited from the container. Constraints should be one of the integers NORTH, SOUTH, EAST, WEST, or CENTER, which defined in yoix.awt and yoix.swing, or case-independent strings that match those names. The constraint can be omitted, and will be assumed to be CENTER, when there is only one component in the layout array. The fields in a BorderLayout are:
hgap A double that represents the horizontal spacing between components in units of 72 dots per inch.
type A read-only int that is set to BORDERLAYOUT, which is defined in yoix.awt and yoix.swing.
vgap A double that represents the vertical spacing between components in units of 72 dots per inch.
The Dialog, Frame, ScrollPane, and Window containers all use BorderLayout as their default layout manager.
 
 Example:   The program,
import yoix.*.*;

JButton b1 = {
    String text = "Button 1";
    Color  background = Color.red;
};

JButton b2 = {
    String text = "Button 2 - Press to quit";
    Color  background = Color.blue;
    Color  foreground = Color.white;

    actionPerformed(e) {
        exit(0);
    }
};

JButton b3 = {
    String text = "Button 3";
    Color  background = Color.green;
};

JFrame f = {
    BorderLayout layoutmanager = {
        double hgap = 18;
        double vgap = 6;
    };

    Array layout = {
        b1, CENTER,
        b2, "East",
        b3, SOUTH
    };
};

f.visible = TRUE;
shows how components, like buttons, are added to a frame that uses a BorderLayout as its layout manager.
 
 See Also:   BoxLayout, CardLayout, CustomLayout, FlowLayout, GridBagLayout, GridLayout, LayoutManager

 

Yoix is a registered trademark of AT&T Intellectual Property.