Vivek Sejpal Vivek Sejpal - 5 months ago 39
Java Question

JavaFx : How to align content in tab?

i'm a beginner in javaFx. I'm trying to align the nodes in various tabs of my application, but unable to find the way. Are there any specific functions to align a node in tab? I'm having nodes such as,combobox labels etc. which i want to align.If not plz specify the way to do it.

thanks in advance


If you want to align the contents of a tab just use the layout container of your choosing and use the alignment options of those.


TabPane myTabPane = new TabPane();
Tab myTab = new Tab();
VBox myTabContent = new VBox();
myTabContent.getChildren().add(new Label("Label 1");
myTabContent.getChildren().add(new Label("Label 2");
myTabContent.getChildren().add(new Label("Label 3");

now just use the alignment options you are used to from VBox (or any other layout container/pane)