-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLAb_Time_Pass.txt
89 lines (77 loc) · 2.27 KB
/
LAb_Time_Pass.txt
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package cp1;
import java.awt.event.ItemEvent;
import java.awt.*;
import java.awt.event.ItemListener;
import javax.swing.ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
public class Suraj_19_Dec extends JFrame implements ItemListener {
JLabel lb1,lb2;
JRadioButton b1,b2;
JCheckBox c1,c2;
ButtonGroup gb1;
Suraj_19_Dec(){
lb1=new JLabel("Program By Suraj");
lb2=new JLabel("OUTPUT");
b1=new JRadioButton("Do");
b2=new JRadioButton("Die");
c1=new JCheckBox("Football");
c2=new JCheckBox("Gym");
gb1=new ButtonGroup();
setLayout(null);
getContentPane().setBackground(Color.PINK);
//b1.setBackground(Color.PINK);
b1.setOpaque(false);
b2.setOpaque(false);
c1.setOpaque(false);
c2.setOpaque(false);
lb1.setForeground(Color.WHITE);
b1.setForeground(Color.WHITE);
b2.setForeground(Color.WHITE);
c1.setForeground(Color.WHITE);
c2.setForeground(Color.WHITE);
//lb2.setForeground(Color.WHITE);
//lb2.setForeground(Color.WHITE);
//lb1.setBackground(Color.PINK);
//b2.setBackground(Color.PINK);
c1.setBackground(Color.PINK);
c2.setBackground(Color.PINK);
lb2.setBackground(Color.PINK);
//setLayout(new BorderLayout());
setContentPane(new JLabel(new ImageIcon("C:\\Users\\student\\Downloads\\kallavesi.jpg")));
lb1.setBounds(225,50,300,60);
b1.setBounds(50,100,300,60);
b2.setBounds(350,100,300,60);
c1.setBounds(50,200,300,100);
c2.setBounds(350,200,300,100);
lb2.setBounds(200,250,550,200);
gb1.add(b1);gb1.add(b2);
add(lb1);add(lb2); add(b1);add(b2); add(c1);add(c2);
setSize(5000,3333);
setVisible(true);
setTitle("Radio Button & Check Box");
b1.addItemListener(this);
b2.addItemListener(this);
c1.addItemListener(this);
c2.addItemListener(this);
}
@Override
public void itemStateChanged(ItemEvent arg0) {
// TODO Auto-generated method stub
String s="You Have Selected :-";
if(b1.isSelected())
s=s+"\n Let's Do it Now";
else
s=s+"Now You Die";
if(c1.isSelected()) s=s+"\n Today u will play Football";
if(c2.isSelected()) s=s+"\n Today u will go to Gym";
lb2.setText(s);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
new Suraj_19_Dec();
}
}