2017-10-24 9 views
0

JavaFXアプリケーションでは、一部のノードがプレビューに表示されますが、選択できず、階層に表示されません。 SceneBuilder untargetable例:SceneBuilderノードを選択できません

SceneBuilder untargetable example

この例では、「ファーストネーム」欄は、ターゲッティングではありません、それは「姓」の欄と同じコードを持っているにもかかわらず、階層に表示されません。 "New ..."と "Edit ..."ボタンと同じことです。

My SceneBuilderのバージョンは8.3.0です。 私はeclipseを使用しています。手動で行う必要がある場合はFXGraphでfxmlを編集しています。

FXML:あなたのFXMLでいくつかの場所で

<AnchorPane xmlns:fx="http://javafx.com/fxml" fx:controller="de.is2.address.view.PersonOverviewController" prefHeight="300.0" prefWidth="600.0"> 

<children> 
    <SplitPane dividerPositions="0.29797979797979796" layoutX="130.0" layoutY="70.0" prefHeight="300.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> 
     <items> 
      <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0"> 
       <children> 
        <TableView fx:id="personTable" layoutX="-25.0" layoutY="-21.0" prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> 
         <columns> 
          <TableColumn fx:id="firstNameColumn" prefWidth="75.0" text="First Name"/> 
         </columns> 
         <columns> 
          <TableColumn fx:id="lastNameColumn" prefWidth="75.0" text="Last Name"/> 
         </columns> 
         <columnResizePolicy><TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /></columnResizePolicy> 
        </TableView> 
       </children> 
      </AnchorPane> 
      <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0"> 
       <children> 
        <Label layoutX="54.0" layoutY="37.0" text="Person Details" AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0"/> 
        <GridPane layoutX="67.0" layoutY="78.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="30.0"> 
         <columnConstraints> 
          <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> 
         </columnConstraints> 
         <columnConstraints> 
          <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/> 
         </columnConstraints> 
         <rowConstraints> 
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> 
         </rowConstraints> 
         <rowConstraints> 
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> 
         </rowConstraints> 
         <rowConstraints> 
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> 
         </rowConstraints> 
         <rowConstraints> 
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> 
         </rowConstraints> 
         <rowConstraints> 
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> 
         </rowConstraints> 
         <rowConstraints> 
          <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/> 
         </rowConstraints> 
         <children> 
          <Label text="First Name"/> 
          <Label text="Last Name" GridPane.rowIndex="1"/> 
          <Label text="Street" GridPane.rowIndex="2"/> 
          <Label text="City" GridPane.rowIndex="3"/> 
          <Label text="Postal Code" GridPane.rowIndex="4"/> 
          <Label text="Birthday" GridPane.rowIndex="5"/> 
          <Label fx:id="firstNameLabel" text="Label" GridPane.columnIndex="1"/> 
          <Label fx:id="lastNameLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="1"/> 
          <Label fx:id="streetLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="2"/> 
          <Label fx:id="cityLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="3"/> 
          <Label fx:id="postalCodeLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="4"/> 
          <Label fx:id="birthdayLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="5"/> 
         </children> 
        </GridPane> 
        <ButtonBar layoutX="203.0" layoutY="244.0" prefHeight="39.0" prefWidth="265.0" AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="10.0"> 
         <buttons> 
          <Button mnemonicParsing="false" text="New..."/> 
         </buttons> 
         <buttons> 
          <Button mnemonicParsing="false" text="Edit..."/> 
         </buttons> 
         <buttons> 
          <Button mnemonicParsing="false" onAction="#handleDeletePerson" text="Delete"/> 
         </buttons> 
        </ButtonBar> 
       </children> 
      </AnchorPane> 
     </items> 
    </SplitPane> 
</children> 

+1

使用しているSceneBuilderのバージョンはどれですか? GridPaneは61行と13列を表示しますか?あなたは実際にそれらのすべてを持っていますか?あなたがそれを選択すると、GridPaneが表示されますか? –

+0

「LastName」という列はありますが、「First Name」という列はありません。列「LastName」は選択可能ですか? – Kerry

+0

@JoséPeredaMy SceneBuilderのバージョンは8.3.0です。 61行13列は奇妙な未使用コードでしたが、どこから来たのか分かりません。FXGraphを使用しているのかもしれません。 それ以外の場合、グリッドパネルは正常に動作しています。 – Julius

答えて

1

、あなたは繰り返しこの(スニペット)のように同じタグの内容を定義している:

<columns> 
    <TableColumn fx:id="firstNameColumn" prefWidth="75.0" text="First Name"/> 
</columns> 
<columns> <!-- repetition!! --> 
    <TableColumn fx:id="lastNameColumn" prefWidth="75.0" text="Last Name"/> 
</columns> 

これは間違っています - タグを一度開いてから、すべての子を指定してから一度閉じる必要があります。あなたは、たとえば、GridPaneの子供たちのためにそれを正しくやっている:

<GridPane layoutX="67.0" layoutY="78.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="30.0"> 
    <children> 
     <Label text="First Name"/> 
     <Label text="Last Name" GridPane.rowIndex="1"/> 
     <Label text="Street" GridPane.rowIndex="2"/> 
     ... 
    </children> 
</GridPane> 

私の経験から、JavaFXの自体が(のように、期待通りに表示される)いくつかの非常に興味深いFXML構文を受け入れますが、SceneBuilderはより保守的になる傾向があるとだけ典型的な構成を受け入れる。これはおそらく、プレビューがうまくいくように見えますが、階層が不完全なためです。 FXMLを手で編集する場合は、まずSceneBuilderが同じ構造を作成する方法を見てみましょう。

あなたはどこにでもネストを訂正した場合は、結果のFXMLは次のとおりです。

<AnchorPane xmlns:fx="http://javafx.com/fxml" fx:controller="de.is2.address.view.PersonOverviewController" 
    prefHeight="300.0" prefWidth="600.0"> 

    <children> 
     <SplitPane dividerPositions="0.29797979797979796" layoutX="130.0" layoutY="70.0" prefHeight="300.0" 
      prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" 
      AnchorPane.topAnchor="0.0"> 
      <items> 
       <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0"> 
        <children> 
         <TableView fx:id="personTable" layoutX="-25.0" layoutY="-21.0" prefHeight="200.0" 
          prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" 
          AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> 
          <columns> 
           <TableColumn fx:id="firstNameColumn" prefWidth="75.0" text="First Name" /> 
           <TableColumn fx:id="lastNameColumn" prefWidth="75.0" text="Last Name" /> 
          </columns> 
          <columnResizePolicy> 
           <TableView fx:constant="CONSTRAINED_RESIZE_POLICY" /> 
          </columnResizePolicy> 
         </TableView> 
        </children> 
       </AnchorPane> 
       <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="160.0" prefWidth="100.0"> 
        <children> 
         <Label layoutX="54.0" layoutY="37.0" text="Person Details" AnchorPane.leftAnchor="5.0" 
          AnchorPane.topAnchor="5.0" /> 
         <GridPane layoutX="67.0" layoutY="78.0" AnchorPane.leftAnchor="5.0" 
          AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="30.0"> 
          <columnConstraints> 
           <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> 
           <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> 
          </columnConstraints> 
          <rowConstraints> 
           <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> 
           <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> 
           <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> 
           <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> 
           <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> 
           <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> 
          </rowConstraints> 
          <children> 
           <Label text="First Name" /> 
           <Label text="Last Name" GridPane.rowIndex="1" /> 
           <Label text="Street" GridPane.rowIndex="2" /> 
           <Label text="City" GridPane.rowIndex="3" /> 
           <Label text="Postal Code" GridPane.rowIndex="4" /> 
           <Label text="Birthday" GridPane.rowIndex="5" /> 
           <Label fx:id="firstNameLabel" text="Label" GridPane.columnIndex="1" /> 
           <Label fx:id="lastNameLabel" text="Label" GridPane.columnIndex="1" 
            GridPane.rowIndex="1" /> 
           <Label fx:id="streetLabel" text="Label" GridPane.columnIndex="1" 
            GridPane.rowIndex="2" /> 
           <Label fx:id="cityLabel" text="Label" GridPane.columnIndex="1" GridPane.rowIndex="3" /> 
           <Label fx:id="postalCodeLabel" text="Label" GridPane.columnIndex="1" 
            GridPane.rowIndex="4" /> 
           <Label fx:id="birthdayLabel" text="Label" GridPane.columnIndex="1" 
            GridPane.rowIndex="5" /> 
          </children> 
         </GridPane> 
         <ButtonBar layoutX="203.0" layoutY="244.0" prefHeight="39.0" prefWidth="265.0" 
          AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="10.0"> 
          <buttons> 
           <Button mnemonicParsing="false" text="New..." /> 
           <Button mnemonicParsing="false" text="Edit..." /> 
           <Button mnemonicParsing="false" onAction="#handleDeletePerson" text="Delete" /> 
          </buttons> 
         </ButtonBar> 
        </children> 
       </AnchorPane> 
      </items> 
     </SplitPane> 
    </children> 
</AnchorPane> 

これは私SceneBuilder 8.4.1で望ましい結果を与える:すべての表の列とのButtonBar内のすべてのボタンはで表示し、選択されています階層。

関連する問題