• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Flow Layout Managers!

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]


reply
    Bookmark Topic Watch Topic
  • New Topic