【发布时间】:2016-03-10 21:25:39
【问题描述】:
我正在尝试向我的ToggleButton 添加一个工具提示,以向用户解释如果他们按下它会发生什么。问题是,我的解释太长了,工具提示用“...”(省略号字符串,是吗?)无论如何,当我通过TooltipBuilder 设置最大/首选项宽度时,就像在这个例子中一样:
this.watched = new ToggleButton("Watched?");
Tooltip tooltip = TooltipBuilder.create().wrapText(true).text(
"Rather than specifying individual images, you can make this source \'watched\',which means that every" +
" time this gallery is viewed, all the images in this directory will be listed.").build();
tooltip.prefWidth(50);
watched.setTooltip(tooltip);
我得到这个结果:
我通过maxWidth(double)、maxWidthProperty().set(double)、prefWidth(double) 和prefWidthProperty().set(double) 设置宽度的尝试已被忽略。
有什么办法可以克服吗?
【问题讨论】:
标签: java width tooltip javafx word-wrap