Reputation: 13858
I am trying to get the TextArea
's prompt text to display in a certain format. I am able to achieve the format I want, but it requires me to add lots of white space between text. I was thinking \n
would do the trick, but it did not. Is there a way to get to the prompt text to go to the next line without wrapText="true"
and lots of white space?
<?xml version="1.0" encoding="UTF-8"?>
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<VBox alignment="TOP_CENTER" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" spacing="10.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ez_proxy_2.toolbar_buttons.AddStanzaController">
<children>
<StackPane>
<children>
<Label alignment="CENTER" maxWidth="1.7976931348623157E308" text="Title">
<font>
<Font size="28.0" />
</font>
<padding>
<Insets top="10.0" />
</padding>
</Label>
<FontAwesomeIconView fx:id="faQuestionMark" glyphName="QUESTION_CIRCLE" size="32" StackPane.alignment="CENTER_RIGHT">
<StackPane.margin>
<Insets right="10.0" />
</StackPane.margin>
</FontAwesomeIconView>
</children>
</StackPane>
<TextField fx:id="tfTitle" alignment="CENTER" promptText="Enter Title Here">
<VBox.margin>
<Insets left="20.0" right="20.0" />
</VBox.margin>
</TextField>
<Label alignment="CENTER" maxWidth="1.7976931348623157E308" text="Stanza Info">
<font>
<Font size="17.0" />
</font>
</Label>
<TextArea fx:id="taStanzaInfo" promptText="Title Fake Title URL https://www.example.com HJ www.example.com DJ example.com" wrapText="true">
<VBox.margin>
<Insets left="20.0" right="20.0" />
</VBox.margin>
</TextArea>
<Button fx:id="btnOff" mnemonicParsing="false" onAction="#handleBtnOff" prefHeight="25.0" prefWidth="52.0" text="Off" />
<HBox alignment="CENTER_RIGHT" prefHeight="100.0" prefWidth="200.0" spacing="10.0">
<children>
<Button fx:id="btnExit" mnemonicParsing="false" onAction="#handleBtnExit" prefHeight="25.0" prefWidth="52.0" text="Exit" />
<Button fx:id="btnAdd" mnemonicParsing="false" onAction="#handleBtnAdd" prefHeight="25.0" prefWidth="52.0" text="Add" />
</children>
<VBox.margin>
<Insets left="20.0" right="20.0" />
</VBox.margin>
</HBox>
</children>
</VBox>
Upvotes: 2
Views: 1871
Reputation: 702
You can try using XML syntax for \r\n
-
(in my test example, for some reason, just
doesn't work for promptText
attribute, but it works fine with text
):
<TextArea promptText="Title Fake Title URL https://www.example.com HJ www.example.com DJ example.comButton" />
Upvotes: 2