forked from arushi019/ap_project_chain_reaction
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtopcontroller.java
More file actions
135 lines (98 loc) · 2.82 KB
/
Copy pathtopcontroller.java
File metadata and controls
135 lines (98 loc) · 2.82 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
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
131
132
133
134
135
package hello.pages;
import java.io.IOException;
import hello.ExceptionClass;
import hello.Main;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Border;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
import javafx.scene.shape.Line;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import hello.pages.s1controller;
public class topcontroller extends AnchorPane
{
@FXML
private AnchorPane top;
@FXML
private Button Undo;
@FXML
private ComboBox<String> options;
ObservableList<String> lst =FXCollections.observableArrayList("New Game","Settings","Back");
@FXML
private void initialize() throws IOException
{
options.setItems(lst);
s1controller.undo=Undo;
}
// @FXML
// public void disable(boolean a) throws IOException
// {
// //System.out.println(Undo);
// Undo.setDisable(a);
//
//
// }
@FXML
private void undo() throws IOException, ClassNotFoundException
{
Main obj=new Main();
try {
obj.undobutton();
} catch (ExceptionClass e) {
// TODO Auto-generated catch block
System.out.println(e.getMessage());
}
}
@FXML
private void options() throws IOException
{
String a=options.getSelectionModel().getSelectedItem();
//System.out.println(a);
if (a.equals("New Game"))
{
// AnchorPane a1=FXMLLoader.load(Main.class.getResource("pages/s1.fxml"));
s1controller obj=new s1controller();
obj.play1();
}
if (a.equals("Settings"))
{
AnchorPane a1=FXMLLoader.load(Main.class.getResource("pages/s2.fxml"));
Main.mainLayout.getChildren().setAll(a1);
}
if (a.equals("Back"))
{
AnchorPane a1=FXMLLoader.load(Main.class.getResource("pages/s1.fxml"));
Main.mainLayout.getChildren().setAll(a1);
}
}
@FXML
private void options1() throws IOException
{
String a=options.getSelectionModel().getSelectedItem();
//System.out.println(a);
if (a.equals("New Game"))
{
// AnchorPane a1=FXMLLoader.load(Main.class.getResource("pages/s1.fxml"));
s1controller obj=new s1controller();
obj.play2();
}
if (a.equals("Settings"))
{
AnchorPane a1=FXMLLoader.load(Main.class.getResource("pages/s2.fxml"));
Main.mainLayout.getChildren().setAll(a1);
}
if (a.equals("Back"))
{
AnchorPane a1=FXMLLoader.load(Main.class.getResource("pages/s1.fxml"));
Main.mainLayout.getChildren().setAll(a1);
}
}
}