Skip a row GridBagLayout

余生颓废 提交于 2019-12-07 17:25:20

问题


I'm using the GridBagLayout on a JFrame and I'd like to be able to skip a row or two but have those rows show up as blank, and then have a button after those rows. I can't find any way in the documentation to do what I described, does anyone know of any way I can do this?


回答1:


Figured it out much cleaner than adding empty components... there is a GridBagConstraint named insets that allows you to choose the white-space between the component you're adding and the other components around it in any direction. Thanks for the answers though!




回答2:


Did you try adding empty components in the row you want to keep blank ? Like empty JPanels ? Or maybe invisible components.



来源:https://stackoverflow.com/questions/10949869/skip-a-row-gridbaglayout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!