• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Flow Layout Managers!

 
Anuja Shah
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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).]

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic