Fix pour les couleurs des boutons

This commit is contained in:
Thomas Rubini 2022-06-07 17:22:27 +02:00
parent c31fa88d68
commit c848fb31c1
No known key found for this signature in database
GPG Key ID: C7D287C8C1CAC373

View File

@ -57,7 +57,7 @@ public class Controller implements Initializable {
// Style des boutons // Style des boutons
Background btNormalBackground = new Background(new BackgroundFill(Color.rgb(255, 110, 64), new CornerRadii(30), Insets.EMPTY)); Background btNormalBackground = new Background(new BackgroundFill(Color.rgb(255, 110, 64), new CornerRadii(30), Insets.EMPTY));
Background btNormalHover = new Background(new BackgroundFill(Color.rgb(255, 152, 120), new CornerRadii(30), Insets.EMPTY)); Background btNormalHover = new Background(new BackgroundFill(Color.rgb(255, 152, 120), new CornerRadii(30), Insets.EMPTY));
Background btNormalSelected = new Background(new BackgroundFill(Color.rgb(255, 60, 0), new CornerRadii(30), Insets.EMPTY)); Background btSelectedBackground = new Background(new BackgroundFill(Color.rgb(255, 60, 0), new CornerRadii(30), Insets.EMPTY));
private void initFrance() { private void initFrance() {
france = FranceBuilder.create() france = FranceBuilder.create()
@ -105,27 +105,29 @@ public class Controller implements Initializable {
onPressHandler = event -> { onPressHandler = event -> {
Button bt = (Button) event.getSource(); Button bt = (Button) event.getSource();
if (bt.getBackground().equals(btNormalSelected)) { if (bt.getBackground().equals(btSelectedBackground)) {
bt.setBackground(btNormalHover); bt.setBackground(btNormalHover);
bt.setOnMouseEntered(onEnterHandler); bt.setOnMouseEntered(onEnterHandler);
bt.setOnMouseExited(onExitHandler);
} else { } else {
if (obj instanceof Discipline) { if (obj instanceof Discipline) {
for (int i = 0; i < discipline.getChildren().size(); ++i) { for (int i = 0; i < discipline.getChildren().size(); ++i) {
Button btChild = (Button) discipline.getChildren().get(i); Button btLoop = (Button) discipline.getChildren().get(i);
btChild.setBackground(btNormalBackground); btLoop.setBackground(btNormalBackground);
btLoop.setOnMouseEntered(onEnterHandler);
btChild.setOnMouseEntered(onEnterHandler); btLoop.setOnMouseExited(onExitHandler);
} }
} else { } else {
for (int i = 0; i < thematique.getChildren().size(); ++i) { for (int i = 0; i < thematique.getChildren().size(); ++i) {
Button btChild = (Button) thematique.getChildren().get(i); Button btLoop = (Button) thematique.getChildren().get(i);
btChild.setBackground(btNormalBackground); btLoop.setBackground(btNormalBackground);
btChild.setOnMouseEntered(null); btLoop.setOnMouseEntered(onEnterHandler);
btLoop.setOnMouseExited(onExitHandler);
} }
} }
bt.setBackground(btNormalSelected);
bt.setOnMouseEntered(null); bt.setOnMouseEntered(null);
bt.setOnMouseExited(null); bt.setOnMouseExited(null);
bt.setBackground(btSelectedBackground);
} }
}; };