aspose file tools*
The moose likes Beginning Java and the fly likes Flow Layout Managers! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Flow Layout Managers!" Watch "Flow Layout Managers!" New topic
Author

Flow Layout Managers!

Anuja Shah
Greenhorn

Joined: Nov 14, 2000
Posts: 8
Hi,
I tried following example:
import java.awt.*;
import java.applet.*;
public class FlowLayout extends Applet{
private Frame f;
private Button button1,button2,button3;
public void init() {
f = new Frame("Flow Layout");
f.setLayout(new FlowLayout());
button1 = new Button("OK");
button2 = new Button("Open");
button3 = new Button("Close");
f.add(button1);
f.add(button2);
f.add(button3);
f.setSize(100,100);
}

public void start() {
f.setVisible(true);
}
When I tried to compile, it giving me following error:
setLayout in java.awt.container cannot applied to (FlowLayout)
f.setLayout(new FlowLayout());
Can anyone help me what is the problem?
Thanks in advance!
Anuja

[This message has been edited by Anuja Shah (edited November 16, 2000).]
Grant Crofton
Ranch Hand

Joined: Nov 08, 2000
Posts: 154
You probably don't want to call your class FlowLayout, as that is already an existing class.
I think when you try to set the layout, it is trying to set it to your FlowLayout (which isn't a LayoutManager at all). call your class something else and it should work OK.
Anuja Shah
Greenhorn

Joined: Nov 14, 2000
Posts: 8

Thanks Grant,
It working now!
Thanks Again,
ANuja
Originally posted by Anuja Shah:
Hi,
I tried following example:
import java.awt.*;
import java.applet.*;
public class FlowLayout extends Applet{
private Frame f;
private Button button1,button2,button3;
public void init() {
f = new Frame("Flow Layout");
f.setLayout(new FlowLayout());
button1 = new Button("OK");
button2 = new Button("Open");
button3 = new Button("Close");
f.add(button1);
f.add(button2);
f.add(button3);
f.setSize(100,100);
}

public void start() {
f.setVisible(true);
}
When I tried to compile, it giving me following error:
setLayout in java.awt.container cannot applied to (FlowLayout)
f.setLayout(new FlowLayout());
Can anyone help me what is the problem?
Thanks in advance!
Anuja

[This message has been edited by Anuja Shah (edited November 16, 2000).]

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Flow Layout Managers!