Пример #1
0
  public void change(String userinput, Scene s) {
    String colorName = userinput.substring(userinput.indexOf(" ") + 1);
    if (!ApplicationColor.hasColor(colorName)) return;

    ApplicationColor selectedColor = ApplicationColor.valueOf(colorName.toUpperCase());
    JFXDecorator decorator = (JFXDecorator) s.lookup(".jfx-decorator");
    JFXToolbar toolbar = (JFXToolbar) s.lookup(".jfx-tool-bar");
    Label label = (Label) s.lookup(".icons-badge Label");
    label.setStyle("-fx-text-fill:" + selectedColor.getColorValue() + ";");
    decorator.setStyle("-fx-decorator-color: derive(" + selectedColor.getColorValue() + ",-20%);");
    toolbar.setStyle("-fx-background-color: " + selectedColor.getColorValue() + ";");
  }
Пример #2
0
  public NavBar() {

    HBox left_side = new HBox();

    burger = new JFXHamburger();
    Label title = new Label("Title");

    left_side.getChildren().addAll(burger, title);
    super.getLeftItems().addAll(left_side);

    JFXHamburger options = new JFXHamburger();
    options.getStyleClass().add("jfx-options-burger");

    // Right Side
    JFXHamburger show = new JFXHamburger();
    show.getStyleClass().add("jfx-options-burger");
    show.setPadding(new Insets(10, 5, 10, 5));
    JFXRippler r = new JFXRippler(show, RipplerMask.CIRCLE, RipplerPos.BACK);

    JFXListView<Label> list = new JFXListView<Label>();

    list.getStyleClass().add("jfx-list");

    Label report_btn = new Label("Report Bug");
    report_btn.setOnMouseClicked(
        (event) -> {
          System.out.println("Work in Progress");
        });
    Label exit_btn = new Label("Exit");
    exit_btn.setOnMouseClicked(
        (event) -> {
          Main.exit();
        });

    list.getItems().addAll(report_btn, exit_btn);

    JFXPopup popup = new JFXPopup();
    popup.setPrefSize(300, 300);
    popup.setContent(list);
    popup.setPopupContainer(this);
    popup.setSource(show);

    r.setOnMouseClicked((e) -> popup.show(PopupVPosition.TOP, PopupHPosition.RIGHT));

    super.getRightItems().add(r);
  }