GridBagConstraints anchor dilemma
From: Gary V (auc_at_worldnet.att.net)
Date: 10/29/04
- Next message: Abs: "Update problems"
- Previous message: Deborah K. Charan: "Re: Updating of a Tree when the label changes"
- Next in thread: Chris Rohr: "Re: GridBagConstraints anchor dilemma"
- Reply: Chris Rohr: "Re: GridBagConstraints anchor dilemma"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Oct 2004 11:30:45 -0700
I am trying line up a single column of several buttons on the left
(West) side of a container but have not been successful. Here is a
simple code example to illustrate how I am attempting this:
import java.awt.*;
public class Vertical extends Frame {
public static void main(String argv[]) {
new Vertical().show();
}
public Vertical() {
Button btn;
GridBagLayout gridbag = new GridBagLayout();
setLayout(gridbag);
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = 0;
constraints.gridy = GridBagConstraints.RELATIVE;
constraints.anchor = GridBagConstraints.WEST;
for (int n = 1; n <= 8; n++) {
btn = new Button("Button " + n);
add(btn);
gridbag.setConstraints(btn, constraints);
}
resize(300, 300);
}
}
When run the buttons are lined up in the center of the Frame. Any
ideas how to anchor the buttons on the left?
Gary V
- Next message: Abs: "Update problems"
- Previous message: Deborah K. Charan: "Re: Updating of a Tree when the label changes"
- Next in thread: Chris Rohr: "Re: GridBagConstraints anchor dilemma"
- Reply: Chris Rohr: "Re: GridBagConstraints anchor dilemma"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]