Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
COMP1206-Mathdoku
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nimrod Abramovich
COMP1206-Mathdoku
Commits
894b3540
Commit
894b3540
authored
5 years ago
by
Nimrod Abramovich
Browse files
Options
Downloads
Patches
Plain Diff
changed highest node to border pane
parent
8903b8c5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/coursework/Main.class
+0
-0
0 additions, 0 deletions
bin/coursework/Main.class
src/coursework/Main.java
+21
-55
21 additions, 55 deletions
src/coursework/Main.java
with
21 additions
and
55 deletions
bin/coursework/Main.class
+
0
−
0
View file @
894b3540
No preview for this file type
This diff is collapsed.
Click to expand it.
src/coursework/Main.java
+
21
−
55
View file @
894b3540
...
@@ -30,6 +30,7 @@ import javafx.scene.control.ToggleGroup;
...
@@ -30,6 +30,7 @@ import javafx.scene.control.ToggleGroup;
import
javafx.scene.image.Image
;
import
javafx.scene.image.Image
;
import
javafx.scene.image.ImageView
;
import
javafx.scene.image.ImageView
;
import
javafx.scene.input.MouseEvent
;
import
javafx.scene.input.MouseEvent
;
import
javafx.scene.layout.BorderPane
;
import
javafx.scene.layout.GridPane
;
import
javafx.scene.layout.GridPane
;
import
javafx.scene.layout.HBox
;
import
javafx.scene.layout.HBox
;
import
javafx.scene.layout.Pane
;
import
javafx.scene.layout.Pane
;
...
@@ -278,7 +279,7 @@ public class Main extends Application {
...
@@ -278,7 +279,7 @@ public class Main extends Application {
vbox
.
getChildren
().
add
(
balanceButtonBottom
);
vbox
.
getChildren
().
add
(
balanceButtonBottom
);
vbox
.
setSpacing
(
10
);
vbox
.
setSpacing
(
10
);
vbox
.
setAlignment
(
Pos
.
CENTER_LEFT
);
vbox
.
setAlignment
(
Pos
.
CENTER_LEFT
);
vbox
.
setPadding
(
new
Insets
(
0
,
0
,
0
,
0
));
vbox
.
setPadding
(
new
Insets
(
1
0
));
return
vbox
;
return
vbox
;
}
}
...
@@ -287,6 +288,7 @@ public class Main extends Application {
...
@@ -287,6 +288,7 @@ public class Main extends Application {
vbox
.
getChildren
().
addAll
(
setupButton
(
"Tiny"
,
10
,
71
),
setupButton
(
"Small"
,
14
,
81
),
setupButton
(
"Medium"
,
18
,
91
),
setupButton
(
"Large"
,
22
,
101
),
setupButton
(
"Huge"
,
26
,
111
));
vbox
.
getChildren
().
addAll
(
setupButton
(
"Tiny"
,
10
,
71
),
setupButton
(
"Small"
,
14
,
81
),
setupButton
(
"Medium"
,
18
,
91
),
setupButton
(
"Large"
,
22
,
101
),
setupButton
(
"Huge"
,
26
,
111
));
vbox
.
setSpacing
(
15
);
vbox
.
setSpacing
(
15
);
vbox
.
setAlignment
(
Pos
.
CENTER
);
vbox
.
setAlignment
(
Pos
.
CENTER
);
vbox
.
setPadding
(
new
Insets
(
10
));
return
vbox
;
return
vbox
;
}
}
...
@@ -741,64 +743,31 @@ public class Main extends Application {
...
@@ -741,64 +743,31 @@ public class Main extends Application {
@Override
@Override
public
void
start
(
Stage
primaryStage
)
throws
Exception
{
public
void
start
(
Stage
primaryStage
)
throws
Exception
{
stage
=
primaryStage
;
stage
=
primaryStage
;
V
Bo
x
vBox
=
new
V
Bo
x
();
Bo
rderPane
borderPane
=
new
Bo
rderPane
();
int
width
=
350
+
80
*
N
;
int
width
=
350
+
80
*
N
;
int
height
=
275
+
80
*
N
;
int
height
=
275
+
80
*
N
;
scene
=
new
Scene
(
vBox
,
width
,
height
);
scene
=
new
Scene
(
borderPane
,
width
,
height
);
stage
.
setWidth
(
width
);
stage
.
setWidth
(
width
);
stage
.
setHeight
(
height
);
stage
.
setHeight
(
height
);
vBox
.
setSpacing
(
5
);
borderPane
.
setPadding
(
new
Insets
(
20
));
vBox
.
setPadding
(
new
Insets
(
20
));
vBox
.
setAlignment
(
Pos
.
CENTER
);
GridPane
gridPane
=
setupGrid
(
width
-
200
,
height
-
175
);
GridPane
gridPane
=
setupGrid
(
width
-
200
,
height
-
175
);
undoStack
.
push
(
new
GameState
(
GameState
.
getCurrentGameState
(
gridNumbers
)));
undoStack
.
push
(
new
GameState
(
GameState
.
getCurrentGameState
(
gridNumbers
)));
fontSize
=
18
;
fontSize
=
18
;
changeFontSizeEvent
(
fontSize
);
changeFontSizeEvent
(
fontSize
);
HBox
topHBox
=
setupTopHBox
();
HBox
topHBox
=
setupTopHBox
();
VBox
fontSizeVBox
=
setupFontSizeHBox
();
VBox
fontSizeVBox
=
setupFontSizeHBox
();
VBox
numbersVBox
=
setupNumbersVBox
();
VBox
numbersVBox
=
setupNumbersVBox
();
HBox
gridHBox
=
new
HBox
();
gridHBox
.
getChildren
().
addAll
(
fontSizeVBox
,
gridPane
,
numbersVBox
);
gridHBox
.
setSpacing
(
10
);
gridHBox
.
setAlignment
(
Pos
.
CENTER
);
HBox
bottomHBox
=
setupBottomHBox
();
HBox
bottomHBox
=
setupBottomHBox
();
/////
borderPane
.
setTop
(
topHBox
);
// Button tempButton = new Button("SHOW ANSWER");
borderPane
.
setLeft
(
fontSizeVBox
);
// int[] answers = {5,6,3,4,1,2,6,1,4,5,2,3,4,5,2,3,6,1,3,4,1,2,5,6,2,3,6,1,4,5,1,2,5,6,3,4};
borderPane
.
setRight
(
numbersVBox
);
// tempButton.setOnAction(e -> {
borderPane
.
setBottom
(
bottomHBox
);
// if (N != 6) {
borderPane
.
setCenter
(
gridPane
);
// Animation animation = new Animation();
// animation.go();
// }
// else {
// BufferedReader file;
// try {
// file = new BufferedReader(new FileReader(new File("C:\\Java Eclipse Workspace\\Programming II Coursework\\mathdokuCage.txt")));
//
// String line;
// while ((line = file.readLine()) != null) {
// createNewCage(line);
// }
// file.close();
//
// for (int i = 0; i < gridNumbers.length; i++) {
// gridNumbers[i].setText(answers[i] + "");
// }
// }
// catch (IOException ex) {
// System.err.println(ex);
// }
// }
// });
/////
vBox
.
getChildren
().
addAll
(
topHBox
,
gridHBox
,
bottomHBox
);
stageWidthResizeEvent
(
stage
,
gridPane
);
stageWidthResizeEvent
(
stage
,
gridPane
);
stageHeightResizeEvent
(
stage
,
gridPane
);
stageHeightResizeEvent
(
stage
,
gridPane
);
...
@@ -814,35 +783,32 @@ public class Main extends Application {
...
@@ -814,35 +783,32 @@ public class Main extends Application {
private
void
resetGrid
()
{
private
void
resetGrid
()
{
stage
.
close
();
stage
.
close
();
initialiseVariables
();
initialiseVariables
();
V
Bo
x
vBox
=
new
V
Bo
x
();
Bo
rderPane
borderPane
=
new
Bo
rderPane
();
;
int
width
=
350
+
80
*
N
;
int
width
=
350
+
80
*
N
;
int
height
=
275
+
80
*
N
;
int
height
=
275
+
80
*
N
;
Stage
newStage
=
new
Stage
();
Stage
newStage
=
new
Stage
();
Scene
newScene
=
new
Scene
(
vBox
,
width
,
height
);
Scene
newScene
=
new
Scene
(
borderPane
,
width
,
height
);
newStage
.
setWidth
(
width
);
newStage
.
setWidth
(
width
);
newStage
.
setHeight
(
height
);
newStage
.
setHeight
(
height
);
vBox
.
setSpacing
(
5
);
borderPane
.
setPadding
(
new
Insets
(
20
));
vBox
.
setPadding
(
new
Insets
(
20
));
vBox
.
setAlignment
(
Pos
.
CENTER
);
GridPane
gridPane
=
setupGrid
(
width
-
200
,
height
-
175
);
GridPane
gridPane
=
setupGrid
(
width
-
200
,
height
-
175
);
undoStack
.
push
(
new
GameState
(
GameState
.
getCurrentGameState
(
gridNumbers
)));
undoStack
.
push
(
new
GameState
(
GameState
.
getCurrentGameState
(
gridNumbers
)));
fontSize
=
18
;
fontSize
=
18
;
changeFontSizeEvent
(
fontSize
);
changeFontSizeEvent
(
fontSize
);
HBox
topHBox
=
setupTopHBox
();
HBox
topHBox
=
setupTopHBox
();
VBox
fontSizeVBox
=
setupFontSizeHBox
();
VBox
fontSizeVBox
=
setupFontSizeHBox
();
VBox
numbersVBox
=
setupNumbersVBox
();
VBox
numbersVBox
=
setupNumbersVBox
();
HBox
gridHBox
=
new
HBox
();
gridHBox
.
getChildren
().
addAll
(
fontSizeVBox
,
gridPane
,
numbersVBox
);
gridHBox
.
setSpacing
(
10
);
gridHBox
.
setAlignment
(
Pos
.
CENTER
);
HBox
bottomHBox
=
setupBottomHBox
();
HBox
bottomHBox
=
setupBottomHBox
();
vBox
.
getChildren
().
addAll
(
topHBox
,
gridHBox
,
bottomHBox
);
borderPane
.
setTop
(
topHBox
);
borderPane
.
setLeft
(
fontSizeVBox
);
borderPane
.
setRight
(
numbersVBox
);
borderPane
.
setBottom
(
bottomHBox
);
borderPane
.
setCenter
(
gridPane
);
stageWidthResizeEvent
(
stage
,
gridPane
);
stageWidthResizeEvent
(
stage
,
gridPane
);
stageHeightResizeEvent
(
stage
,
gridPane
);
stageHeightResizeEvent
(
stage
,
gridPane
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment