Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to limit the width of the content of a ScrollPane
    text
    copied!<p>I have a Scrollpane witch contains several TitledPanes in a VBox. I want to only scroll in vertical direction. The width of the content should be limited to the width of the ScrollPane. How can i get the TitledPane to Clip the Title when it's width is bigger than the width of the ScrollPane? In the moment the TitledPane adapts it's width to the width of the Title, independent of any maxWidth, Fit to Width or similar settings.</p> <p>Fabian</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;?import java.lang.*?&gt; &lt;?import java.util.*?&gt; &lt;?import javafx.geometry.*?&gt; &lt;?import javafx.scene.control.*?&gt; &lt;?import javafx.scene.layout.*?&gt; &lt;?import javafx.scene.paint.*?&gt; &lt;AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="454.0" prefWidth="260.0" xmlns:fx="http://javafx.com/fxml"&gt; &lt;children&gt; &lt;ScrollPane fitToWidth="true" hbarPolicy="AS_NEEDED" hmax="1.0" pannable="false" prefHeight="200.0" prefViewportWidth="100.0" prefWidth="200.0" vbarPolicy="AS_NEEDED" AnchorPane.bottomAnchor="0.0" AnchorPane. leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"&gt; &lt;content&gt; &lt;VBox maxWidth="200.0" prefHeight="500.0" prefWidth="480.0" spacing="5.0"&gt; &lt;children&gt; &lt;TitledPane animated="false" maxWidth="200.0" text="Very long title, should be clipped. Very long title, should be clipped. " textOverrun="CLIP" wrapText="true"&gt; &lt;content&gt; &lt;AnchorPane id="Content" minHeight="0.0" minWidth="0.0" prefHeight="500.0" prefWidth="200.0"&gt; &lt;children&gt; &lt;ListView prefHeight="500.0" prefWidth="200.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" /&gt; &lt;/children&gt; &lt;/AnchorPane&gt; &lt;/content&gt; &lt;/TitledPane&gt; &lt;/children&gt; &lt;padding&gt; &lt;Insets bottom="5.0" left="5.0" right="5.0" top="5.0" /&gt; &lt;/padding&gt; &lt;/VBox&gt; &lt;/content&gt; &lt;/ScrollPane&gt; &lt;/children&gt; &lt;/AnchorPane&gt; </code></pre> <p><a href="https://www.dropbox.com/s/qnoz4mg2ny2wn4l/Ohne%20Titel.png" rel="nofollow">Example Image</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload