Peter Penzov
Peter Penzov

Reputation: 1670

How to add visual separator between accordion and table in JavaFX

I want to add visual separator which can be dragged and resized by the used. I tested this code:

public class VerticalSeparator {

    public void initVSeparator(Stage primaryStage, Group root, Scene scene) {

        //Vertical separator
        Separator separator2 = new Separator();
        separator2.setLayoutX(300);
        separator2.setLayoutY(300);

        separator2.setOrientation(Orientation.VERTICAL);

        root.getChildren().add(separator2);

    }
} 

But for some reason I don't get anything into the primary stage. Can you tell me what I'm missing?

Upvotes: 0

Views: 285

Answers (1)

Sergey Grinev
Sergey Grinev

Reputation: 34518

There is SplitPane control which provides a draggable separator.

    SplitPane pane = new SplitPane();
    pane.getItems().addAll(myTable, myAccordion);

P.S.: It's hard to tell what's wrong with your code without seeing usage of VerticalSeparator class.

Upvotes: 3

Related Questions