【问题标题】:Create scrolling text when text is too long当文本太长时创建滚动文本
【发布时间】:2015-06-05 16:57:27
【问题描述】:

我有一个动态构建的字符串,它有时太长,但仍需要完全显示给用户。我宁愿让文本滚动而不是为其创建工具提示。

我已经用这个创建了一个标签:

Label text = new Label("hello there i hope this text is long enough to take up space");
TranslateTransition tran = new TranslateTransition(Duration.millis(75000));
tran.setNode(text);
tran.setByX(-400);
tran.setInterpolator(Interpolator.LINEAR);
tran.setCycleCount(Timeline.INDEFINITE);
// add the text
tran.play();

一,当我这样做时,如果文本是 "this is really long" 并且它被缩短为 "this is really..." 那么当标签滚动时,文本仍然是 "this is really..."。另一件事是这会滚动标签,改变元素的 x 位置。有没有办法只改变滚动实例的文本?

另外,有没有办法以编程方式确定给定文本对于指定区域是否会太大?

【问题讨论】:

标签: css javafx javafx-2 javafx-8 horizontal-scrolling


【解决方案1】:
猜你喜欢
  • 2014-12-01
  • 2021-10-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-11-29
  • 1970-01-01
  • 2016-11-04
相关资源
最近更新 更多