Code: Select all
public class NewMain extends Application {
@Override
public void start(Stage stage) throws Exception {
var button1 = new Button("Button 1");
button1.setStyle("-fx-min-height: 100000");
var toolBar = new ToolBar(button1);
toolBar.setStyle("-fx-max-height: 2em; -fx-min-height:2em; -fx-padding: 5; -fx-background-color: yellow;");
var vBox = new VBox(toolBar);
stage.setScene(new Scene(vBox, 600, 400));
stage.show();
}
public static void main(String[] args) {
launch(args);
}
}
[img]https://i.sstatic. net/OWfPRb18.png[/img]
Wenn beispielsweise 1em == 15 ist, muss die Schaltflächenhöhe 20 (15*2 - 10) betragen. Könnte jemand sagen, wie man das macht? Und wenn möglich wäre es gut, eine Lösung mit CSS und ohne die Erstellung zusätzlicher Knoten zu bekommen.