public ExpandButton() { getStyleClass().add("quickbar-expand-button"); toggle.getStyleClass().addAll("pdfsam-toolbar-button", "quickbar-expand-toggle"); expand.setContent("M0,-5L5,0L0,5Z"); expand.getStyleClass().add("quickbar-button-arrow"); collapse.setContent("M0,-5L-5,0L0,5Z"); collapse.getStyleClass().add("quickbar-button-arrow"); toggle.setGraphic(expand); toggle.selectedProperty().addListener((observable, oldValue, newValue) -> { if (newValue) { toggle.setGraphic(collapse); } else { toggle.setGraphic(expand); } }); HBox.setMargin(toggle, new Insets(0, 7, 0, 7)); getChildren().add(toggle); }