Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
下图描述了我的问题。我只想将标签设置为左侧而不是右侧的“...”-ed,因为这是更重要的部分。从代码开始,我可以向您展示我是如何设置标签的(但这并不重要):
final Label directory = new Label(); directory.setText(selectedDirectory.getPath());
你可以做
directory.setStyle("-fx-text-overrun: leading-ellipsis;");
或者,在外部样式表中:
.label { -fx-text-overrun: leading-ellipsis ; }