-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCB.java
More file actions
58 lines (36 loc) · 1.44 KB
/
CB.java
File metadata and controls
58 lines (36 loc) · 1.44 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
import javax.swing.*;
import java.awt.*;
import java.awt.FlowLayout;
import java.awt.Container;
class CB{
public static void main(String args[]){
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setBounds(100,100,800,500);
frame.setTitle("Java Checkbox");
Container c=frame.getContentPane();
c.setLayout(null);
JLabel l1=new JLabel("When pakistan was established?");
l1.setBounds(100,100,300,20);//location=left,top,width,height
c.add(l1);
JCheckBox cb1= new JCheckBox("a>- 1956");
cb1.setBounds(100,150,100,20);//location=left,top,width,height
c.add(cb1);
JCheckBox cb2= new JCheckBox("b>- 1947");
cb2.setBounds(100,200,100,20);//location=left,top,width,height
c.add(cb2);
JCheckBox cb3= new JCheckBox("c-> 1950");
cb3.setBounds(100,250,100,20);//location=left,top,width,height
c.add(cb3);
JCheckBox cb4= new JCheckBox("d-> None");
cb4.setBounds(100,300,100,20);//location=left,top,width,height
c.add(cb4);
cb1.setSelected(true);
Cursor cur=new Cursor(Cursor.HAND_CURSOR);//CROSSHAIR_CURSOR //WAIT
cb1.setCursor(cur);
//btn.setEnabled(false); Disabled button
// btn.setVisible(false); UnVisible or Hidden bUTTON
//ImageIcon icon= new ImageIcon("IMG-20200208-WA0002.jpg");
//btn.setSize(icon.getIconWidth(),icon.getIconHeight());
frame.setVisible(true);
}}