By setting layout to null you can customize your own layout style. SetLayout(null) statement will disable default FlowLayout and then by using setBounds() function you can easily set location of any control and width and height of the control as well. setBounds() function has four parameters.
import java.awt.*;
import java.applet.*;
public class lademo extends Applet
{
Button b1;
TextField t1;
public void init()
{
setLayout(null);
t1 = new TextField(10);
b1 = new Button("Hello");
add(b1);
add(t1);
b1.setBounds(100,200,100,50); // coloumn, row, width, height
t1.setBounds(100,400,100,50);
}
};
Technorati Tags : JAVA, Default Layout
No comments:
Post a Comment