forked from Metropolice23/Reversi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Option.java
59 lines (59 loc) · 1.26 KB
/
Option.java
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
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Option extends JFrame
{
private Mybutton exit;
private JRadioButton no;
private JRadioButton yes;
private Mainframe mf;
public Option(Mainframe mf)
{
setSize(1043,696);
setLocation(220,80);
setUndecorated(true);
JPanel p=new JPanel();
p.setLayout(null);
this.mf=mf;
MyActionListener al=new MyActionListener();
exit=new Mybutton(161,46,61,596);
exit.addActionListener(al);
//yes.addActionListener(al);
yes = new JRadioButton();
yes.setSelected(true);
yes.setSize(17,17);
yes.setLocation(709,218);
//no.addActionListener(al);
no = new JRadioButton();
no.setSelected(true);
no.setSize(16,17);
no.setLocation(512,216);
ButtonGroup timegroup=new ButtonGroup();
timegroup.add(yes);
timegroup.add(no);
p.add(exit);
p.add(yes);
p.add(no);
JLabel option=new JLabel(new ImageIcon("option.png"));
option.setSize(1043,696);
add(p);
p.add(option);
setVisible(true);
}
public class MyActionListener implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
JButton b=(JButton)e.getSource();
if(b==exit)
{
if(yes.isSelected())
{mf.setclock("ëï");}
if(no.isSelected())
{mf.setclock("ìà");}
mf.setVisible (true);
dispose();
}
}
}
}