-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathDetailsButtonWithSwing.java
More file actions
60 lines (48 loc) · 1.11 KB
/
DetailsButtonWithSwing.java
File metadata and controls
60 lines (48 loc) · 1.11 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.*;
import java.awt.event.*;
import javax.swing.*;
public class DetailsButtonWithSwing
{
public DetailsButtonWithSwing()
{
JFrame F=new JFrame();
F.setVisible(true);
F.setSize(400,400);
F.setLayout(new FlowLayout());
F.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel l=new JLabel();
F.add(l);
JButton b1,b2;
b1=new JButton("A");
ActionListener a1=new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
l.setText("Name-Shrutika Shaw Course-CS Rollno-2019345 College-SRCASW ");
}
};
b1.addActionListener(a1);
F.add(b1);
b2=new JButton("B");
ActionListener a2=new ActionListener()
{
public void actionPerformed(ActionEvent ae)
{
l.setText("CGPA-8.27");
}
};
b2.addActionListener(a2);
F.add(b2);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
SwingUtilities.invokeLater(
new Runnable()
{
public void run()
{
new DetailsButtonWithSwing();
}
});
}
}