-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirstApp.java
More file actions
33 lines (17 loc) · 879 Bytes
/
firstApp.java
File metadata and controls
33 lines (17 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.awt.*;
public class firstApp {
public static void main(String arg[])
{
Frame f=new Frame("My first app");
f.setLayout(new FlowLayout()); // this will reduce size of ok button window
f.setSize(500,500); // size of frame
f.setVisible(true); //showing the frame on screen
Button b = new Button("Ok"); // to add button u need f.add compulsorily
Label l=new Label("Name:"); // to add button u need f.add compulsorily
TextField tf=new TextField(20);// to add button u need f.add compulsorily
f.add(l);
f.add(tf);
f.add(b); // however this will create the size of button to be equal to the size of frame.
// so you will have to set flow layout....see line 6
}
}