Like the title suggests, I want to resize grid components so that if there is a small component inside of a grid it will remove excess space.
Here's an example of what it currently looks like:
Instead it should look like this:
I'm using a GridLayout
. Which looks kinda like:
grid = new JPanel(new GridLayout(1, 3));
grid.add(JPanel1);
grid.add(Jpanel2);
grid.add(JTextField);`
Any ideas?
EDIT: I fixed the problem by using a MigLayout(Thanks @Blip) and overriding the preferred size. Blip then told me not to override, rather use the MigLayout's additional functionality to get the same results. While that would work, I also decided to change the height of the JTextField. Otherwise I would use the other solution. But thanks everyone for the help!