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
|
package gogetter.vues;
import javafx.scene.CustomNode;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.layout.Panel;
import javafx.scene.layout.HBox;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.geometry.VPos;
def LEVELS: String[] = [
##[EASY_LEVEL_LABEL]"Facile",
##[MEDIUM_LEVEL_LABEL]"Moyen",
##[HARD_LEVEL_LABEL]"Difficile"
];
public class Demarrage extends CustomNode {
public-init var debug: Boolean = false;
public var width: Number = 300 on replace {
requestLayout()
}
public var height: Number = 210 on replace {
requestLayout()
}
// public var controleInterne: IControleur;
def levelChoice: ChoiceBox = ChoiceBox {
id: "levelChoice"
items: LEVELS
}
def titleLabel: Label = Label {
id: "titleLabel"
styleClass: "title-label"
text: ##[TITLE_LABEL]"*****menu*****"
layoutX: bind (width - titleLabel.layoutBounds.width) / 2;
}
def padding: Number = 6;
def bottomHBox: HBox = HBox {
id: "bottomBox"
styleClass: "bottom-hbox"
width: bind width - 2 * padding
layoutX: bind padding
layoutY: bind height - bottomHBox.layoutBounds.height - padding;
nodeVPos: VPos.CENTER
content: [
Label {
id: "levelLabel"
styleClass: "level-label"
text: ##[LEVEL_LABEL]"Niveau :"
}
levelChoice,
Panel {
id: "filler"
}
Button {
id: "startButton"
style: "-fx-font-size: 200%"
text: ##[START_LABEL]"Start"
action: bind valider
}
]
}
def rootPanel: Panel = Panel {
id: "rootPanel"
width: bind width
height: bind height
content: [
titleLabel,
bottomHBox,
Rectangle {
id: "titleBounds"
fill: null
stroke: Color.RED
x: bind titleLabel.boundsInParent.minX
y: bind titleLabel.boundsInParent.minY
width: bind titleLabel.boundsInParent.width
height: bind titleLabel.boundsInParent.height
visible: bind debug
}
Rectangle {
id: "bottomBounds"
fill: null
stroke: Color.BLUE
x: bind bottomHBox.boundsInParent.minX
y: bind bottomHBox.boundsInParent.minY
width: bind bottomHBox.boundsInParent.width
height: bind bottomHBox.boundsInParent.height
visible: bind debug
}
Label {
id: "screenBounds"
text: bind "{width} x {height}"
visible: bind debug
}
]
}
init {
children = rootPanel;
levelChoice.select(0);
}
postinit {
requestLayout();
}
var valider: function(): Void;
} |
Partager