[英]Add a List<JToogleButton> to a JPanel
I have a List<JToggleButton>
and I need to add all those buttons to a panel. 我有一个
List<JToggleButton>
,我需要将所有这些按钮添加到面板中。
The panel needs to have only a vertical scrollbar. 该面板仅需要一个垂直滚动条。 It has a fixed size of
600 x 600
px. 它的固定尺寸为
600 x 600
像素。
Buttons have different sizes and I need them look pretty compact (for example, some rows can have two big buttons, some four smaller). 按钮具有不同的大小,我需要它们看起来非常紧凑(例如,某些行可以具有两个大按钮,而另一些则可以小四个)。 I need to add the buttons by order from list (first with index 0, then 1 and so on..).
我需要按顺序从列表中添加按钮(首先是索引0,然后是1,依此类推。)。
How to achieve this layout? 如何实现这种布局?
您可以尝试将带有FlowLayout
的JPanel
放在JScrollPane
然后添加所有按钮。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.