This is my code:
public class NewMain1 extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
HBox root = new HBox();
ToolBar toolbar = new ToolBar();
toolbar.getItems().addAll(new TextField(), new Separator(), new Button("foo"), new Button("bar"));
root.getChildren().addAll(toolbar);
primaryStage.setScene(new Scene(root, 400, 400));
primaryStage.show();
}
}
And this is the result:
As you can see the distance between a text field and a separator (left margin) is less then the distance between the separator and a button (right margin).
Could anyone say how to decrease right margin that right margin to be equal to the left margin using CSS?
I found out how to do it using CSS. This is the solution:
.tool-bar > .container > .separator:vertical *.line {
-fx-border-insets: 0 0 0 3, 0 0 0 4;
}