-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsw.java
More file actions
60 lines (46 loc) · 1.29 KB
/
sw.java
File metadata and controls
60 lines (46 loc) · 1.29 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import java.awt.event.ActionEvent;
import java.awt.Color;
import java.awt.event.ActionListener;
import javax.swing.*;
class sw extends JFrame implements ActionListener {
JButton Input;
JTextField roll_in, name_in, marks_in, result;
sw() {
super("LOL");
this.setSize(250,150);
roll_in = new JTextField(10);
marks_in = new JTextField(10);
name_in = new JTextField(10);
result = new JTextField(10);
result.setEditable(false);
Input = new JButton("Submit");
Input.addActionListener(this);
JPanel panel = new JPanel();
panel.add(new JLabel("Roll No"));
panel.add(roll_in);
panel.add(new JLabel("Name"));
panel.add(name_in);
panel.add(new JLabel("marks"));
panel.add(marks_in);
panel.add(Input);
panel.add(result);
add(panel);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void actionPerformed(ActionEvent e) {
String roll, name, marks;
roll = roll_in.getText();
name = name_in.getText();
marks = marks_in.getText();
System.out.println(roll);
System.out.println(name);
System.out.println(marks);
System.out.println(e.getSource() == Input);
setBackground(Color.blue);
result.setText("Done");
}
public static void main(String[] args) {
new sw();
}
}