我想垂直堆叠JComponent
,类似于JList
,但是由于项目数量很少,并且我想要一个高度自定义的界面-我想尝试垂直堆叠的一组组件。
垂直的BoxLayout
应该是最简单的。
您可以尝试使用GridBagLayout管理器并调整GridBagConstraints
属性(gridy和gridx属性)以获得所需的结果。
BoxLayout(panel, BoxLayout.Y_AXIS), GridLayout(0, 1)
,如果真的需要GridBagLayout
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.