2017-10-21 21 views
0

저는 Javafx 애플리케이션을 가지고 있습니다.이 애플리케이션은 새로운 스테이지에서 각각 시작되는 일련의 툴을 사용자에게 제공합니다. 몇 시간 동안 노력했지만이 단계 중 하나에서 수직 스크롤바가 표시되지 않습니다. 스테이지의 하단 부분을 볼 수 없기 때문에 가로 스크롤 막대에 액세스하지도 않습니다. SceneBuilder에서 스테이지를 시도 할 때 무대 공간이 적습니다 (이상한 점도 있지만 내 관심사는 아닙니다). 가로 스크롤 막대가 보이지만 여전히 세로 막대는 아닙니다.Javafx 스테이지에 V-Scrollbar가 표시되지 않습니다.

스테이지는 중첩 된 fxml로 구성됩니다. 주요한 것은 Treeview가있는 Splitpane을 포함합니다. Treeview의 사용자 선택에 따라 컨트롤러는 다른 fxml을로드합니다.이 fxml은 항상 일치하는 ui가 포함 된 Scrollpane이며이를 splitpane의 다른쪽에 넣습니다. 문제를 일으키는 것은이 Scrollpane입니다.

protected ChangeListener<TreeItem<UserRequirement>> getRequirementSelectionChangeListener() { 
    return new ChangeListener<TreeItem<UserRequirement>>() { 
     @Override 
     public void changed(ObservableValue<? extends TreeItem<UserRequirement>> observable, TreeItem<UserRequirement> oldValue, TreeItem<UserRequirement> newValue) { 

      logger.debug("User selected requirement: " + newValue.getValue().debug()); 

      UserRequirement oldRequirement = newValue.getValue(); 
      reqService.save(oldRequirement); 

      UserRequirement newRequirement = newValue.getValue(); 

      try { 
       if(currentLevel != newRequirement.getLevel()) { 
        currentLevel = newRequirement.getLevel(); 
        RequirementsFactory factory = RequirementFactoryProducer.getRequirementFactory(newRequirement.getLevel()); 
        ScrollPane reqPane = factory.getHierarchyPane(); 
        splitPane.getItems().add(reqPane); 
        ctrl = factory.getHierarchyController(); 
       } 
       ctrl.setSystemContext(getSelectedProduct()); 
       ctrl.setRequirement(newRequirement); 

       stage.sizeToScene(); 
       stage.centerOnScreen(); 
       splitPane.setDividerPosition(0, 0.1); 
      } catch (Exception e) { 
       // TODO Auto-generated catch block 
       e.printStackTrace(); 
      } 
     } 
    }; 
} 
:이 분할 구획의 우측에 스크롤두고 컨트롤러 내의 코드는

protected void showEditor(URL url, Window parent) { 
     FXMLLoader fxmlLoader = new FXMLLoader(url); 
     fxmlLoader.setControllerFactory(springContext::getBean); // lookup the controller from the spring application context 
     try { 
      Parent appNode = fxmlLoader.load(); 
      SystemDependent ctrl = fxmlLoader.getController(); 
      ctrl.setSystemContext(mySelectedSystem); 
      Scene scene = new Scene(appNode); 

      Stage stage = new Stage(); 
      ctrl.setStage(stage); 
      //stage.initOwner(parent); 
      stage.setScene(scene); 

      stage.show(); 

     } catch (IOException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
    } 

: 여기

snapshot showing the stage w/o scrollbars

새로운 단계를 시작 코드

바깥 쪽 fxml :

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

<?import javafx.geometry.Insets?> 
<?import javafx.scene.control.Label?> 
<?import javafx.scene.control.ScrollPane?> 
<?import javafx.scene.control.SplitPane?> 
<?import javafx.scene.control.TreeView?> 
<?import javafx.scene.layout.AnchorPane?> 
<?import javafx.scene.layout.BorderPane?> 
<?import javafx.scene.layout.HBox?> 

<BorderPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="-Infinity" minWidth="-Infinity" stylesheets="@../stylesheets/controller.css" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.agiletunes.controllers.requirement.RequirementEditorCtrl"> 
    <top> 
     <HBox alignment="BOTTOM_LEFT" maxWidth="1.7976931348623157E308" nodeOrientation="LEFT_TO_RIGHT" BorderPane.alignment="BOTTOM_LEFT"> 
      <children> 
       <Label styleClass="tool" text="Header"> 
       </Label> 
       <Label styleClass="editor" text="header"> 
       </Label> 
      </children> 
      <BorderPane.margin> 
       <Insets bottom="10.0" left="20.0" right="20.0" top="20.0" /> 
      </BorderPane.margin> 
     </HBox> 
    </top> 
    <center> 
     <SplitPane fx:id="splitPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" BorderPane.alignment="CENTER"> 
     <items> 
      <AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" styleClass="pane"> 
       <children> 
        <ScrollPane fitToHeight="true" fitToWidth="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" AnchorPane.bottomAnchor="20.0" AnchorPane.leftAnchor="20.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0"> 
        <content> 
         <TreeView fx:id="requirementsTreeView" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" /> 
        </content> 
        </ScrollPane> 
       </children> 
      </AnchorPane> 
     </items> 
     <BorderPane.margin> 
      <Insets /> 
     </BorderPane.margin> 
     </SplitPane> 
    </center> 
</BorderPane> 
,363,210

및 분할 구획은 :

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

<?import javafx.geometry.Insets?> 
<?import javafx.scene.control.Button?> 
<?import javafx.scene.control.ComboBox?> 
<?import javafx.scene.control.Label?> 
<?import javafx.scene.control.Pagination?> 
<?import javafx.scene.control.ScrollPane?> 
<?import javafx.scene.control.Tab?> 
<?import javafx.scene.control.TabPane?> 
<?import javafx.scene.control.TextArea?> 
<?import javafx.scene.control.TextField?> 
<?import javafx.scene.control.Tooltip?> 
<?import javafx.scene.layout.AnchorPane?> 
<?import javafx.scene.layout.ColumnConstraints?> 
<?import javafx.scene.layout.GridPane?> 
<?import javafx.scene.layout.HBox?> 
<?import javafx.scene.layout.RowConstraints?> 
<?import javafx.scene.text.Font?> 
<?import javafx.scene.web.HTMLEditor?> 

<ScrollPane fitToHeight="true" fitToWidth="true" pannable="true" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.agiletunes.controllers.requirement.UserStoryEditorCtrl"> 
     <content> 
      <GridPane fx:id="gridPane" hgap="10.0" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" styleClass="pane" stylesheets="@../stylesheets/controller.css" vgap="10.0"> 
       <columnConstraints> 
        <ColumnConstraints hgrow="SOMETIMES" minWidth="20.0" percentWidth="9.0" /> 
        <ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="10.0" /> 
        <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="7.0" /> 
        <ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="10.0" /> 
        <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="7.0" /> 
        <ColumnConstraints hgrow="SOMETIMES" minWidth="80.0" percentWidth="7.0" /> 
        <ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="10.0" /> 
        <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" percentWidth="7.0" /> 
        <ColumnConstraints hgrow="ALWAYS" maxWidth="1.7976931348623157E308" minWidth="10.0" /> 
       </columnConstraints> 
       <rowConstraints> 
        <RowConstraints fillHeight="false" minHeight="10.0" vgrow="SOMETIMES" /> 
        <RowConstraints fillHeight="false" vgrow="NEVER" /> 
        <RowConstraints maxHeight="1.7976931348623157E308" minHeight="50.0" prefHeight="100.0" vgrow="ALWAYS" /> 
        <RowConstraints fillHeight="false" vgrow="SOMETIMES" /> 
        <RowConstraints fillHeight="false" vgrow="SOMETIMES" /> 
        <RowConstraints maxHeight="1.7976931348623157E308" vgrow="ALWAYS" /> 
       </rowConstraints> 
       <children> 
        <HBox alignment="BOTTOM_LEFT" maxWidth="1.7976931348623157E308" nodeOrientation="LEFT_TO_RIGHT" GridPane.columnSpan="9" GridPane.valignment="BOTTOM"> 
         <GridPane.margin> 
          <Insets bottom="10.0" left="15.0" /> 
         </GridPane.margin> 
         <children> 
          <Label styleClass="tool2" text="Header"> 
           <font> 
            <Font name="System Bold" size="28.0" /> 
           </font> 
          </Label> 
         </children> 
        </HBox> 
        <ComboBox fx:id="personaComboBox" maxWidth="1.7976931348623157E308" promptText="- select -" GridPane.columnSpan="2" GridPane.hgrow="ALWAYS" GridPane.rowIndex="2" GridPane.valignment="TOP"> 
         <GridPane.margin> 
          <Insets left="20.0" right="5.0" /> 
         </GridPane.margin> 
        </ComboBox> 
        <Label text="Label" GridPane.rowIndex="1" GridPane.valignment="BOTTOM"> 
         <padding> 
          <Insets left="10.0" /> 
         </padding> 
         <GridPane.margin> 
          <Insets left="20.0" /> 
         </GridPane.margin> 
         <font> 
          <Font name="System Bold" size="15.0" /> 
         </font> 
        </Label> 
        <Label text="label" GridPane.columnIndex="2" GridPane.rowIndex="1" GridPane.valignment="BOTTOM"> 
         <GridPane.margin> 
          <Insets left="5.0" /> 
         </GridPane.margin> 
         <font> 
          <Font name="System Bold" size="15.0" /> 
         </font> 
        </Label> 
        <Label text="label" GridPane.columnIndex="5" GridPane.rowIndex="1" GridPane.valignment="BOTTOM"> 
         <GridPane.margin> 
          <Insets left="5.0" /> 
         </GridPane.margin> 
         <font> 
          <Font name="System Bold" size="15.0" /> 
         </font> 
        </Label> 
        <Label text="label" GridPane.columnIndex="7" GridPane.columnSpan="2" GridPane.rowIndex="1" GridPane.valignment="BOTTOM"> 
         <GridPane.margin> 
          <Insets left="5.0" /> 
         </GridPane.margin> 
         <font> 
          <Font name="System Bold" size="15.0" /> 
         </font> 
        </Label> 
        <TextArea fx:id="triggerTextArea" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" promptText="&lt;when&gt;" wrapText="true" GridPane.columnIndex="2" GridPane.columnSpan="3" GridPane.hgrow="ALWAYS" GridPane.rowIndex="2" GridPane.vgrow="ALWAYS"> 
         <GridPane.margin> 
          <Insets /> 
         </GridPane.margin> 
        </TextArea> 
        <TextArea fx:id="featureTextArea" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" promptText="&lt;what&gt;" wrapText="true" GridPane.columnIndex="5" GridPane.columnSpan="2" GridPane.hgrow="ALWAYS" GridPane.rowIndex="2" GridPane.vgrow="ALWAYS"> 
         <GridPane.margin> 
          <Insets /> 
         </GridPane.margin> 
        </TextArea> 
        <TextArea fx:id="resultTextArea" maxWidth="1.7976931348623157E308" prefHeight="200.0" prefWidth="200.0" promptText="&lt;why&gt;" wrapText="true" GridPane.columnIndex="7" GridPane.columnSpan="2" GridPane.hgrow="ALWAYS" GridPane.rowIndex="2" GridPane.vgrow="ALWAYS"> 
         <GridPane.margin> 
          <Insets right="12.0" /> 
         </GridPane.margin> 
        </TextArea> 
        <Label text="label" GridPane.rowIndex="4"> 
         <GridPane.margin> 
          <Insets left="30.0" right="10.0" /> 
         </GridPane.margin> 
        </Label> 
        <Button fx:id="newVersionButton" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#createNewVersion" text="New" GridPane.columnIndex="4" GridPane.halignment="LEFT" GridPane.hgrow="SOMETIMES" GridPane.rowIndex="4"> 
         <GridPane.margin> 
          <Insets left="10.0" /> 
         </GridPane.margin> 
        </Button> 
        <Label text="label" GridPane.columnIndex="5" GridPane.halignment="LEFT" GridPane.rowIndex="4"> 
         <GridPane.margin> 
          <Insets left="10.0" /> 
         </GridPane.margin> 
        </Label> 
        <ComboBox fx:id="statusComboBox" maxWidth="1.7976931348623157E308" onAction="#handleStatusChange" onContextMenuRequested="#showStatusHistory" promptText="- select -" GridPane.columnIndex="6" GridPane.hgrow="ALWAYS" GridPane.rowIndex="4"> 
         <GridPane.margin> 
          <Insets /> 
         </GridPane.margin> 
        </ComboBox> 
        <Label text="label" GridPane.rowIndex="3"> 
         <GridPane.margin> 
          <Insets left="30.0" right="10.0" /> 
         </GridPane.margin> 
        </Label> 
        <TextField fx:id="rankTextField" editable="false" maxWidth="1.7976931348623157E308" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS" GridPane.rowIndex="3"> 
         <GridPane.margin> 
          <Insets right="10.0" /> 
         </GridPane.margin> 
        </TextField> 
        <Label text="label" GridPane.columnIndex="2" GridPane.halignment="LEFT" GridPane.rowIndex="4"> 
         <GridPane.margin> 
          <Insets right="10.0" /> 
         </GridPane.margin> 
        </Label> 
        <TextField fx:id="creationDateTextField" editable="false" maxWidth="1.7976931348623157E308" GridPane.columnIndex="3" GridPane.hgrow="ALWAYS" GridPane.rowIndex="4" /> 
        <TextField fx:id="authorTextField" editable="false" maxWidth="1.7976931348623157E308" GridPane.columnIndex="8" GridPane.hgrow="ALWAYS" GridPane.rowIndex="4"> 
         <GridPane.margin> 
          <Insets right="12.0" /> 
         </GridPane.margin> 
        </TextField> 
        <Label text="label" GridPane.columnIndex="7" GridPane.halignment="LEFT" GridPane.rowIndex="4"> 
         <GridPane.margin> 
          <Insets left="10.0" /> 
         </GridPane.margin> 
        </Label> 
        <ComboBox fx:id="myVersionComboBox" maxWidth="1.7976931348623157E308" onAction="#versionSelection" promptText="- select -" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS" GridPane.rowIndex="4"> 
         <GridPane.margin> 
          <Insets right="10.0" /> 
         </GridPane.margin> 
        </ComboBox> 
        <Label text="label" GridPane.columnIndex="5" GridPane.halignment="LEFT" GridPane.rowIndex="3"> 
         <GridPane.margin> 
          <Insets left="10.0" /> 
         </GridPane.margin> 
        </Label> 
        <ComboBox fx:id="prioComboBox" maxWidth="1.7976931348623157E308" promptText="- select -" GridPane.columnIndex="3" GridPane.columnSpan="2" GridPane.hgrow="ALWAYS" GridPane.rowIndex="3" /> 
        <Label text="label" GridPane.columnIndex="2" GridPane.halignment="LEFT" GridPane.rowIndex="3"> 
         <GridPane.margin> 
          <Insets right="10.0" /> 
         </GridPane.margin> 
        </Label> 
        <TabPane fx:id="tabPane" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" tabClosingPolicy="UNAVAILABLE" GridPane.columnSpan="2147483647" GridPane.hgrow="ALWAYS" GridPane.rowIndex="5" GridPane.vgrow="ALWAYS"> 
         <tabs> 
          <Tab text="Tab 1"> 
           <content> 
            <fx:include fx:id="embeddedAcceptanceCriteria" source="AcceptanceCriteriaEditorPane.fxml" /> 
           </content> 
          </Tab> 
          <Tab text="Tab 2"> 
           <content> 
            <fx:include fx:id="embeddedEffortEstimate" source="EffortEstimationEditorPane.fxml " /> 
           </content> 
          </Tab> 
          <Tab text="Tab 3"> 
           <content> 
            <Pagination fx:id="pagination" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" pageCount="0" /> 
           </content> 
          </Tab> 
          <Tab text="Description"> 
           <content> 
            <HTMLEditor fx:id="descriptionTextArea" htmlText="&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body contenteditable=&quot;true&quot;&gt;&lt;/body&gt;&lt;/html&gt;" onKeyReleased="#keyReleased" prefHeight="200.0" prefWidth="506.0" /> 
           </content> 
          </Tab> 
          <Tab text="Tab 5"> 
           <content> 

        </content> 
          </Tab> 
         <Tab text="Tab 6"> 
          <content> 
          <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" /> 
          </content> 
         </Tab> 
         </tabs> 
         <GridPane.margin> 
          <Insets bottom="20.0" left="12.0" right="12.0" /> 
         </GridPane.margin> 
        </TabPane> 
        <TextField fx:id="releaseTextField" editable="false" GridPane.columnIndex="6" GridPane.rowIndex="3" /> 
        <Label text="Label" GridPane.columnIndex="7" GridPane.halignment="LEFT" GridPane.rowIndex="3"> 
         <GridPane.margin> 
          <Insets left="10.0" /> 
         </GridPane.margin> 
        </Label> 
        <TextField fx:id="iterationTextField" editable="false" GridPane.columnIndex="8" GridPane.rowIndex="3"> 
         <GridPane.margin> 
          <Insets right="12.0" /> 
         </GridPane.margin> 
        </TextField> 
       </children> 
       <padding> 
        <Insets bottom="15.0" left="15.0" right="15.0" top="15.0" /> 
       </padding> 
      </GridPane> 
     </content> 
     </ScrollPane> 

어떤 도움을 매우 높이 평가된다. 미리 감사드립니다.

답변

1

스크롤 창에서 모든 UI 요소를 중첩 시키십시오.

+0

무엇을 의미합니까? 오른쪽의 모든 요소는 이미 ScrollPane에 있습니다. 외부 BorderPane 다이얼로그를 ScrollPane에 배치하면 (자), 홀수가되는 종류의 UI가 사용됩니다. 아니면이 테스트가 근본 원인을 확인하는 데 도움이되는 자극을 제공합니까? – Alex

+0

어쨌든 사용해 보았습니다. 차이 없음. 그래서 뭔가 더 근본적인 잘못이라고 생각하게되었습니다. 그래서 나는 VBox에 대해 BorderPane을 변경했다. 그리고, 나는 스크롤바를 볼 수 있습니다. 지금은 더 좋지만 다른 문제가 있습니다. 오른쪽 창에 여전히 수직 스크롤 패널이없고 오른쪽 Splitpane 부분의 헤더 상단 부분이 대부분 빠져 있습니다. – Alex