java - JavaFX: New line spacing between texts in TextFlow
问题描述
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.
解决方案
您可以为TextFlow
. 默认值已经是 0,所以你可以通过给一个负值让它们看起来更接近:
textFlow.setLineSpacing(-2.0);
推荐阅读
- r - GGPLOT 相对频率直方图
- javascript - 如何在 React-native 中显示来自 Firebase 存储的图像?
- python - 来自加密表的 Psycopg2 查询
- arrays - 无法在 C# 中使用其他方法中的数组
- python - 无法解决,终结GeneratorDataset迭代器时出错:Failed precondition: Python解释器状态未初始化
- python - 不支持的操作数类型 - 将秒除以分钟
- json - JSON 格式化程序到 Swift 结构到解析
- r - 分组类别热图
- node.js - 文件夹内的 Procfile 调用不起作用
- php - Laravel websockets 未在本地主机上显示实时统计信息