-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavaAwtpg.java
More file actions
36 lines (31 loc) · 815 Bytes
/
javaAwtpg.java
File metadata and controls
36 lines (31 loc) · 815 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
34
35
import java.awt.*;
import java.awt.event.*;
import java.util.Scanner;
import javax.swing.text.LabelView;
class javaAwtpg extends Frame implements ActionListener {
TextField tf;
int c;
Button b;
javaAwtpg(){
b=new Button("Submit");
tf=new TextField();
Label l=new Label("Calculate two numbers :");
l.setBounds(20,70,200,30);
b.setBounds(100,130,80,30);
b.addActionListener(this);
tf.setBounds(20,100,200,20);
setSize(300,300);
add(l);
add(b);
add(tf);
setLayout(null);
setVisible(true);
}
public void actionPerformed(ActionEvent e){
c=(10+20);
tf.setText("Sum is : "+c);
}
public static void main(String[] args) {
new javaAwtpg();
}
}