How to set/remove insets in JavaFX TitledPane -


i've created titledpane in javafx single child component (a button) follows:

<?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> 

this appears below. there quite bit spacing around button, i'd reduce either 0 or maybe, single pixel. don't see property of either anchorpane or titledpane this. there such property?

enter image description here

use scenic view figure out issues this.

the anchorpane inside titledpane has padding of 0.8em (10px) on sides. defined in default stylesheet, modena.css. can reset in fxml:

<?import java.lang.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import javafx.geometry.insets?>  <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" text="untitled" anchorpane.bottomanchor="0.0" anchorpane.leftanchor="0.0" anchorpane.rightanchor="0.0" anchorpane.topanchor="0.0">             <content>                 <anchorpane >                 <padding>                         <insets top="0" right="0" left="0" bottom="0"/>                                  </padding>                     <children >                         <button mnemonicparsing="false" text="button" anchorpane.bottomanchor="0.0" anchorpane.leftanchor="0.0" anchorpane.rightanchor="0.0" anchorpane.topanchor="0.0" />                     </children>                 </anchorpane>             </content>         </titledpane>     </children> </anchorpane> 

or external style sheet with

.titled-pane > * > * > anchorpane {     -fx-padding: 0em ; } 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -