Label1.java
Aim:
To display labels using AWT Frame.
Source code:
import java.awt.*;
public class Label1
{
public static void main(String args[])
{
Frame f=new Frame("Label example");
Label lab1=new Label("Enter a");
lab1.setBounds(100,100,80,20);
Label lab2=new Label("Enter b");
lab2.setBounds(100,150,200,80);
f.add(lab1);
f.add(lab2);
f.setSize(500,500);
f.setLayout(null);
f.setVisible(true);
}
}
Output:
No comments:
Post a Comment