Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8171071

SplitPane is not visible after visible property changes

XMLWordPrintable

    • generic
    • generic

      FULL PRODUCT VERSION :
      I tested the following code using the JDK 1.8.0_91, the JDK 1.8.0_111 and the actual JDK 1.8.0_112.

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 10 [Version 10.0.14393]
      Microsoft Windows 8 [Version 6.3.9600]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      I use IntelliJ IDEA IDE.

      A DESCRIPTION OF THE PROBLEM :
      Please try the following **FXML view** with the corresponding **controller**. The source code demonstrates that **SplitPane** stay hidden after change its **visible property** (set true value).

      The **SplitPane** appears after resizing the window.

      I tested using the **FlowPane** instead the **SplitPane** and the **FlowPane** works fine.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Please try source code filled in **Source code for an executable test case**.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The SplitPane is immediately visible.
      ACTUAL -
      The SplitPane is not immediately visible.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No error message nor crash.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      // === sample.fxml ====================================================
      <?import javafx.scene.layout.AnchorPane?>
      <?import javafx.scene.control.Button?>
      <?import javafx.scene.control.SplitPane?>
      <?import javafx.scene.text.Text?>

      <AnchorPane xmlns:fx="http://javafx.com/fxml"
                  fx:controller="sample.Controller">
          <Button fx:id="button"
                  alignment="CENTER"
                  onMouseClicked="#buttonClicked">
              Make split pane visible
          </Button>
          <SplitPane fx:id="splitPane"
                     AnchorPane.topAnchor="0.0"
                     AnchorPane.rightAnchor="0.0"
                     AnchorPane.bottomAnchor="0.0"
                     AnchorPane.leftAnchor="0.0"
                     visible="false">
              <items>
                  <Text>Left content</Text>
                  <Text>Right content</Text>
              </items>
          </SplitPane>
      </AnchorPane>

      // === Controller.java ====================================================
      package sample;

      import javafx.fxml.FXML;
      import javafx.scene.control.Button;
      import javafx.scene.control.SplitPane;

      public class Controller {
          @FXML
          private Button button;
          @FXML
          private SplitPane splitPane;

          @FXML
          private void buttonClicked() {
              button.setVisible(false);
              splitPane.setVisible(true);
          }
      }

      // === Main.java ====================================================
      package sample;

      import javafx.application.Application;
      import javafx.fxml.FXMLLoader;
      import javafx.scene.Parent;
      import javafx.scene.Scene;
      import javafx.stage.Stage;

      public class Main extends Application {

          @Override
          public void start(Stage primaryStage) throws Exception{
              Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
              primaryStage.setTitle("Hello World");
              primaryStage.setScene(new Scene(root, 300, 275));
              primaryStage.show();
          }


          public static void main(String[] args) {
              launch(args);
          }
      }
      ---------- END SOURCE ----------

            aghaisas Ajit Ghaisas
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: