0

I have a SplitPane with two items: progress bar (top pane) and action buttons (e.g., ok/cancel) as the bottom pane. When the page is load, both panes are displayed. During initial load, I want to have the top pane hidden and the bottom pane displayed. The top pane will be display when an action event occurs via button click. How should I modify the code to be able to execute the described scenario

FXML

<?xml version="1.0" encoding="UTF-8"?>

<?import com.ngc.gs.dialogs.widgets.*?>
<?import java.lang.*?>
<?import java.net.*?>
<?import java.util.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>

<AnchorPane fx:id="progressMainAnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" prefHeight="390.0002999999924" prefWidth="398.9998779296875" xmlns:fx="http://javafx.com/fxml" fx:controller="com.ngc.gs.dialogs.widgetexample.MyCheckBoxSelController">
  <TreeView fx:id="localTreeView" prefHeight="181.0" prefWidth="363.0" AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="21.0" AnchorPane.topAnchor="14.0" />
  <SplitPane fx:id="progressSplitPane" focusTraversable="true" maxWidth="1.7976931348623157E308" orientation="VERTICAL" prefHeight="181.0" prefWidth="362.999755859375" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="21.0" AnchorPane.topAnchor="195.0">
    <items>
        <ProgressBarMessageConsoleWidget id="pBarConsoleWidget" fx:id="pBarConsoleWidget" minHeight="150.0" minWidth="0.0" prefHeight="150.0" prefWidth="361.0" />
        <OkCancelButtonsWidget id="actionButtonsWidget" fx:id="actionButtonsWidget" minHeight="0.0" minWidth="0.0" prefHeight="100.0" prefWidth="160.0" />
    </items>
  </SplitPane>
  <stylesheets>
    <URL value="@../styles/dialogs.css" />
  </stylesheets>
</AnchorPane>

Controller class snippet that sets the splitPane divider:

....
progressSplitPane.setDividerPosition(0, 0.0);
        progressSplitPane.setResizableWithParent(progressMainAnchorPane, true);

        actionButtonsWidget.getOkBtn().setOnAction(new EventHandler<ActionEvent>()  {
            @Override
            public void handle(ActionEvent evnt) {
                // Show progress bar and message console

                progressSplitPane.setDividerPosition(0, 0.75);
                pBarConsoleWidget.showProgressConsole();

                processCheckBoxSelections();
            }
        });
...
Cœur
  • 37,241
  • 25
  • 195
  • 267
user1772523
  • 141
  • 1
  • 9

1 Answers1

0

I resolved this by implementing a GridPane instead and adding listener to the property as described here... JavaFX HBox hide item

Community
  • 1
  • 1
user1772523
  • 141
  • 1
  • 9