1

下图描述了我的问题。我只想将标签设置为左侧而不是右侧的“...”-ed,因为这是更重要的部分。从代码开始,我可以向您展示我是如何设置标签的(但这并不重要):

final Label directory = new Label();

directory.setText(selectedDirectory.getPath());

问题

4

1 回答 1

2

你可以做

directory.setStyle("-fx-text-overrun: leading-ellipsis;");

或者,在外部样式表中:

.label {
    -fx-text-overrun: leading-ellipsis ;
}
于 2015-04-23T17:28:27.627 回答