This commit is contained in:
Timi
2026-05-11 21:38:37 +08:00
parent 6837781383
commit 88f3e135ff
37 changed files with 358 additions and 658 deletions

View File

@@ -90,7 +90,7 @@ public class SelectableLabel extends TextArea implements TimiFXUI, TimiFXUI.Colo
bindTextStyle(paragraphNodes.getChildren());
widthProperty().addListener((obs, oldValue, newValue) -> {
if (oldValue.doubleValue() < newValue.doubleValue()) {
if (paragraphNodes.getChildren().get(0) instanceof Text text) {
if (paragraphNodes.getChildren().getFirst() instanceof Text text) {
setPrefHeight(Utils.computeTextHeight(getFont(), getText(), getWidth(), text.getBoundsType()));
}
}
@@ -108,8 +108,8 @@ public class SelectableLabel extends TextArea implements TimiFXUI, TimiFXUI.Colo
* @param list 文本节点,必须是 {@link Text}
*/
private void bindTextStyle(List<? extends Node> list) {
for (int i = 0; i < list.size(); i++) {
if (list.get(i) instanceof Text text) {
for (Node node : list) {
if (node instanceof Text text) {
text.fillProperty().bind(textFillProperty);
text.textAlignmentProperty().bind(textAlignmentProperty);
}