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
|
package test;
import gui.Block;
import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.effect.BlurType;
import javafx.scene.effect.DropShadow;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
// will eventually extend pane
public class Level extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
primaryStage.setTitle("program");
BorderPane background = new BorderPane();
Scene game = new Scene(background, 800, 600);
GridPane blockGrid = new GridPane();
blockGrid.setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY)));
background.setCenter(blockGrid);
blockGrid.maxWidthProperty().bind(game.heightProperty().multiply(0.53));
blockGrid.maxHeightProperty().bind(game.heightProperty());
System.out.println(game.heightProperty());
//blockGrid.setMaxHeight(700);
//blockGrid.setMaxWidth(500);
//blockGrid.setScaleX(1);
//blockGrid.setScaleY(1);
//blockGrid.scaleXProperty().bind(game.heightProperty().divide(1000));
//blockGrid.scaleYProperty().bind(game.heightProperty().divide(1000));
//blockGrid.hgapProperty().bind(blockGrid.heightProperty().divide(11));
//blockGrid.vgapProperty().bind(blockGrid.widthProperty().divide(21));
blockGrid.setVgap(10);
blockGrid.setHgap(25);
int blocksize = 50;
//AnchorPane b11 = new AnchorPane();
//b11.getChildren().add(new Block(Color.ORANGE, b11, 10));
Block b1 = new Block(Color.RED, blocksize, blocksize, 10);
//b1.heightProperty().bind(blockGrid.heightProperty().divide((blockGrid.getColumnCount()*2)+1));
//b1.widthProperty().bind(blockGrid.widthProperty().divide((blockGrid.getRowCount()*2)+1));
Block b2 = new Block(Color.BLUE, blocksize, blocksize, 10);
//b2.heightProperty().bind(blockGrid.heightProperty().divide(21));
//b2.widthProperty().bind(blockGrid.widthProperty().divide(11));
Block b3 = new Block(Color.GREEN, blocksize, blocksize, 10);
//b3.heightProperty().bind(blockGrid.heightProperty().divide(21));
//b3.widthProperty().bind(blockGrid.widthProperty().divide(11));
Block b4 = new Block(Color.YELLOW, blocksize, blocksize, 10);
//b4.heightProperty().bind(blockGrid.heightProperty().divide(21));
//b4.widthProperty().bind(blockGrid.widthProperty().divide(11));
Pane test = new Pane();
Block b5 = new Block(Color.ORANGE, blocksize, blocksize, 10);
DropShadow dropShadow = new DropShadow();
dropShadow.setRadius(200.0);
dropShadow.setColor(Color.ORANGE);
dropShadow.setBlurType(BlurType.GAUSSIAN);
test.getChildren().add(b5);
test.setEffect(dropShadow);
blockGrid.add(b1, 0, 0);
blockGrid.add(b2, 1, 0);
blockGrid.add(b3, 0, 1);
blockGrid.add(b4, 1, 1);
blockGrid.add(test, 1, 2);
Button btn = new Button();
btn.setText("Test");
btn.setOnAction(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent event)
{
System.out.println("test");
}
});
background.setLeft(btn);
primaryStage.setScene(game);
primaryStage.show();
}
}
|