Flow layout in java
Flow Layout:
Constructor:
a)
FlowLayout()
It
is the default constructor of the FlowLayout
b)
FlowLayout(int align)
This
method is used to specify the alignment for the component which we place using
this layout. The alignment is specified using the three static constants ,
LEFT,RIGHT,and CENTER.
c)
FlowLayout(int align,int hgap,int vgap)
This
method is used for specifying the alignment and well as the horizontal and the
vertical gap we want to leave.
import java.applet.*;
import java.awt.*;
/*
<applet
code="FlowLayout1" height=200 width=200>
</applet>
*/
public class FlowLayout1 extends
Applet
{
public
void init()
{
setLayout(new
FlowLayout(FlowLayout.RIGHT,5,5));
for(int
i=1;i<=20;i++)
{
add(new
Button("Button "+i));
}
}
}
Comments
Post a Comment