-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy paths7controller.java
130 lines (107 loc) · 3.03 KB
/
s7controller.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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package hello.pages;
import java.awt.Dimension;
import java.awt.Font;
import java.io.IOException;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import hello.Main;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
public class s7controller
{
public static int red7=s2controller.red[4];
public static int green7=s2controller.green[4];
public static int blue7=s2controller.blue[4];
@FXML
private AnchorPane subroots7;
@FXML
private Button Backs7;
@FXML
private TextField reds7;
@FXML
private TextField greens7;
@FXML
private TextField blues7;
@FXML
private void initialize() throws IOException
{
reds7.setText(Integer.toString(red7));
greens7.setText(Integer.toString(green7));
blues7.setText(Integer.toString(blue7));
}
//
// @FXML
// private void reds7() throws IOException
// {
// //System.out.println("abc");
// //System.out.println(reds7.getText());
// int a=Integer.parseInt(reds7.getText());
// s2controller.red[4]=a;
// red7=a;
// }
//
// @FXML
// private void greens7() throws IOException
// {
// int a=Integer.parseInt(greens7.getText());
// s2controller.green[4]=a;
// green7=a;
// }
//
// @FXML
// private void blues7() throws IOException
// {
// int a=Integer.parseInt(blues7.getText());
// s2controller.blue[4]=a;
// blue7=a;
// }
//
@FXML
private void backs7() throws IOException
{
int a1=Integer.parseInt(reds7.getText());
int a2=Integer.parseInt(greens7.getText());
int a3=Integer.parseInt(blues7.getText());
int counter=0;
for(int i=0;i<8;i++)
{
if(i!=4)
{
if(s2controller.red[i]==a1 && s2controller.green[i]==a2 && s2controller.blue[i]==a3)
{
counter=-1;
reds7.setText(Integer.toString(red7));
greens7.setText(Integer.toString(green7));
blues7.setText(Integer.toString(blue7));
JLabel label = new JLabel("Sorry!This colour belongs to another player.Choose another one.");
label.setFont(new Font("Arial", Font.BOLD, 18));
UIManager.put("OptionPane.minimumSize",new Dimension(500,100));
int input =JOptionPane.showOptionDialog(null, label,"Warning",JOptionPane.DEFAULT_OPTION,JOptionPane.INFORMATION_MESSAGE, null, null,null);
if(input==0)
{
//System.out.println(reds4.getText());
AnchorPane a=FXMLLoader.load(Main.class.getResource("pages/s7.fxml"));
Main.mainLayout.getChildren().setAll(a);
}
break;
}
}
}
if(counter==0)
{
s2controller.red[4]=a1;
red7=a1;
s2controller.green[4]=a2;
green7=a2;
s2controller.blue[4]=a3;
blue7=a3;
AnchorPane a=FXMLLoader.load(Main.class.getResource("pages/s2.fxml"));
subroots7.getChildren().setAll(a);
Main.give_obj();
}
}
}