问题
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