0

How can I reduce the space between the 2 texts?

I have the following code:

Text t1 = new Text("Header Text");
Text t2 = new Text("\nBody Text");
TextFlow textFlow = new TextFlow(t1,t2);
textFlow.setTextAlignment(TextAlignment.CENTER);
textFlow.setPadding(new Insets(0));

The gap between "Header Text" and "Body Text" is too wide, is there any way i can reduce this space? I'm using JavaFX Text.

4

1 回答 1

1

您可以为TextFlow. 默认值已经是 0,所以你可以通过给一个负值让它们看起来更接近:

textFlow.setLineSpacing(-2.0);
于 2019-12-30T16:12:42.473 回答