我創建了一個JavaFX的一個TitledPane具有如下單個子組件(按鈕)插圖:如何設置/刪除JavaFX中TitledPane
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<TitledPane animated="false" layoutX="137.0" layoutY="60.0" prefHeight="400.0" prefWidth="600.0" text="untitled" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<content>
<AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0" >
<children >
<Button layoutX="193.1875" layoutY="133.5" mnemonicParsing="false" prefHeight="374.0" prefWidth="598.0" text="Button" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
</children>
</AnchorPane>
</content>
</TitledPane>
</children>
</AnchorPane>
這顯示如下。在按鈕周圍有一個很大的間距,我想把它減少到0或者可能只有一個像素。我沒有看到AnchorPane或TitledPane會執行此操作的任何屬性。有這樣的財產嗎?
風景優美的建議 – PhilDin
@James_D:我試過這個,但由於某種原因CSS解決方案無法正常工作。我爲此提出了一個新問題:http://stackoverflow.com/questions/29607725/remove-insets-in-javafx-titledpane-with-css-not-working – Perneel