玩N +三重播放布局
有没有一种简单的方法可以使三重播放中的元素包装起来并继续下面的内容?
例如,如果我有这样的代码:
Group letters = new Group(AxisLayout.horizontal(), Style.HALIGN.left);
letters.addStyles(Styles.make(Style.TEXT_WRAP.is(true)));
root.add(letters);
for (int i = 0; i < 100; i++) {
letters.add(new Label(""+i));
}
这将显示一些数字(最多,比如说 30),其余的数字将消失在屏幕外,我想要的是这样的:
01 02 03 .. 28
29 30 31 ... 50
因此,任何不适合屏幕的组件都会添加到下面。我尝试了一些设置,但无法获得它,
谢谢
Is there an easy way to make elements in tripleplay wrap and continue below?
For example if I have this code:
Group letters = new Group(AxisLayout.horizontal(), Style.HALIGN.left);
letters.addStyles(Styles.make(Style.TEXT_WRAP.is(true)));
root.add(letters);
for (int i = 0; i < 100; i++) {
letters.add(new Label(""+i));
}
That would show some numbers (up to, say, 30) and the rest of the numbers will dissappear off-screen, what I want to have is something like:
01 02 03 ... 28
29 30 31 ... 50
So whatever component doesn't fit on screen will be added below. I tried a few settings but wasn't able to get it
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

Style.TEXT_WRAP
仅适用于Label
。 Swing 的 FlowLayout 的 Tripleplay UI 中没有等效项,我认为这就是您想要的。如果您确实只想布置一堆文本,那么只需将其全部粘贴到一个标签中并启用文本换行即可。但是,如果您尝试在流程中布局实际的用户界面元素,那么您需要编写自己的
FlowLayout
。您还可以使用TableLayout
,但这要求您提前知道需要多少列。我一直发现 FlowLayout 是一种奇怪的用户界面布局方式,并且从来没有需要它,因此我没有为 Tripleplay UI 编写一个。
Style.TEXT_WRAP
is only applicable toLabel
s. There is no equivalent in Tripleplay UI of Swing'sFlowLayout
which is what I think you want.If you really just want to lay out a bunch of text, then just stick it all in one label with text wrapping enabled. But if you're trying to layout actual user interface elements in a flow, then you'll need to write your own
FlowLayout
. You can also useTableLayout
, but that requires that you know how many columns you want in advance.I've always found
FlowLayout
to be a weird way to lay out user interfaces, and have never had a need for it, hence I did not write one for Tripleplay UI.