Note that there are some explanatory texts on larger screens.

plurals
  1. POWord wrapping inside a TitledPane that is inside VBox
    primarykey
    data
    text
    <p>I have TitledPanes which contain large amounts of text. The TitledPanes are put inside of a VBox to lay them out vertically. But, when placed in a VBox, the TitlePane's width becomes the full width of the text instead of wrapping the text. How do I make it so that TitlePane's width is that of the available area, wrapping it's content, if necessary?</p> <p>In this example, the text wrapping works as intended, but there's no VBox, so you can't have more than one TitledPane.</p> <pre><code>package nimrandsLibrary.fantasyCraft.characterBuilder import javafx.scene.control._ import javafx.scene.layout._ import javafx.scene._ class TiltedTextExample extends javafx.application.Application { def start(stage : javafx.stage.Stage) { val titledPane = new TitledPane() titledPane.setText("Expand me!") val label = new Label("Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here.") label.setWrapText(true) titledPane.setContent(label) stage.setScene(new Scene(titledPane, 300, 300)) stage.show() } } object TiltedTextExample extends App { javafx.application.Application.launch(classOf[TiltedTextExample]) } </code></pre> <p>In this example, the TitledPane is placed inside a VBox so that multiple TitlePanes can be added and stacked vertically. Inexplicably, this breaks the word wrapping behavior.</p> <pre><code>package nimrandsLibrary.fantasyCraft.characterBuilder import javafx.scene.control._ import javafx.scene.layout._ import javafx.scene._ class TiltedTextExample extends javafx.application.Application { def start(stage : javafx.stage.Stage) { val titledPane = new TitledPane() titledPane.setText("Expand me!") val label = new Label("Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here. Some really long text here.") label.setWrapText(true) titledPane.setContent(label) val vBox = new VBox() vBox.getChildren().add(titledPane) stage.setScene(new Scene(vBox, 300, 300)) stage.show() } } object TiltedTextExample extends App { javafx.application.Application.launch(classOf[TiltedTextExample]) } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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