Positioning FlowLayout items.

Basically, I want to position a TextField in a particular location in my Applet.

The .setLocation(x,y) doesn't seem to do anything. I've tried messing around with FlowLayout settings but nothing is allowing me to explicitly specify where I want this TextField.

What am I doing wrong?

//

private Button HitButton;

private Button StickButton;

private Button ConnectButton;

private TextField ConnectField;

....

//

setLayout(new FlowLayout());

HitButton =new Button("Hit!");

StickButton =new Button("Stick!");

setLayout(new FlowLayout(FlowLayout.CENTER));

ConnectButton =new Button("Connect!");

ConnectField =new TextField(15);

ConnectField.setLocation(100,100);

add(HitButton);

add(StickButton);

add(ConnectButton);

add(ConnectField);

[1333 byte] By [acron86a] at [2007-11-26 12:55:28]
# 1
You could set the layout to null. You could also try the [url http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Container.html#add(java.awt.Component,%20int)]add(Component c, int index)[/url] method.
CaptainMorgan08a at 2007-7-7 16:48:58 > top of Java-index,Desktop,Core GUI APIs...
# 2
Or use a different layout manager (and don't use setLocation).The whole point of using layout managers is that you delegate responsibility to laying out components to them. If possible, choose one that does what you want.
paulcwa at 2007-7-7 16:48:58 > top of Java-index,Desktop,Core GUI APIs...