blob: e0ad663c0918eae3d122230147a65753c3651ea3 (
plain) (
blame)
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
|
package gui;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
public class LevelSelector extends Pane
{
public LevelSelector()
{
ListView<String> levels = new ListView<String>();
ObservableList<String> levelList= FXCollections.observableArrayList ("Test Level 1", "Test Level 2", "Test Level 3", "Test Level 4");
levels.setItems(levelList);
levels.minWidthProperty().bind(super.widthProperty().multiply(0.25));
levels.minHeightProperty().bind(super.heightProperty().multiply(0.75));
Button exit = new Button();
exit.setText("Exit");
exit.setOnAction(e -> Driver.setMenu("MainMenu"));
VBox leftBox = new VBox();
leftBox.setAlignment(Pos.CENTER_LEFT);
leftBox.setSpacing(10);
leftBox.getChildren().addAll(levels,exit);
Text title = new Text();
title.setText("Test level 1");
title.setFill(Color.WHITE);
title.setFont(new Font(50));
title.wrappingWidthProperty().bind(super.widthProperty().multiply(0.37));
Text desc = new Text();
desc.setText("long description with lots of words. what we write does not actually need to be long i just wan t make sure it can word wrap");
desc.setFill(Color.WHITE);
desc.wrappingWidthProperty().bind(super.widthProperty().multiply(0.37));
ImageView previewView = new ImageView();
Image preview = new Image("assets/pico.png");
previewView.setImage(preview);
//previewView.setFitHeight(100);
previewView.fitWidthProperty().bind(super.widthProperty().multiply(0.25));
previewView.setPreserveRatio(true);
VBox details = new VBox();
details.minWidthProperty().bind(super.widthProperty().multiply(0.37));
details.minHeightProperty().bind(super.heightProperty().multiply(0.75));
details.maxWidthProperty().bind(super.widthProperty().multiply(0.37));
details.maxHeightProperty().bind(super.heightProperty().multiply(0.75));
details.getStyleClass().add("textBox");
details.getChildren().addAll(title,desc,previewView);
Button play = new Button();
play.setText("Play");
VBox rightBox = new VBox();
rightBox.setAlignment(Pos.CENTER_RIGHT);
rightBox.setSpacing(10);
rightBox.getChildren().addAll(details,play);
HBox rootBox = new HBox();
rootBox.minWidthProperty().bind(super.widthProperty());
rootBox.minHeightProperty().bind(super.heightProperty());
rootBox.getChildren().addAll(leftBox, rightBox);
rootBox.setAlignment(Pos.CENTER);
rootBox.setSpacing(10);
super.getChildren().add(rootBox);
}
}
|