Friday, 24 January 2014

Simple Layout Demo Program using Applet

import java.awt.*;
import java.applet.*;

public class layoutDemo extends Applet
{
    Button b1, b2, b3;
    public void init()
    {
        b1 = new Button("One");
        b2 = new Button("Two");
        b3 = new Button("Three");
        
        setLayout(new GridLayout(2,2));
        setLayout(new BorderLayout());
        setLayout(null);
        add(b1);      
        add(b2);
        add(b3);
        
        b1.setBounds(100,100, 100, 30);
        b2.setBounds(200,100, 100, 30);
        b3.setBounds(100,200, 100, 30);
        
    }
        
}

/*
<applet code="layoutDemo" width="500" height="500"></applet>
*/

OUTPUT



0 comments:

Post a Comment

Followers