Modify the insets.

When I am building a GridBagLayout i want to be able to come back and change settings later on. Reason is that I am doing a code reuse where I have a parameter named “boolean ripped” that determines if I want to show a small version of the panel. The small version might set some aubpanel to have size 0 effectively not showing certain parts of the panel.

I also want to be able to adjust insets

basicall

if(ripped==true)
{
blahblah;
blah;
blahblahblah;
}

so inside those begin and end I want to be able to modify insets. how?
I can easily fix it on creation but what if I want to be able to have a already created object with gridbaglayout and change the insets afterwards?

Rather than change the gridbag insets, could you just set an EmptyBorder on your component? This way, the change is local to your component and not embedded in the arcane details of a layout manager. I suppose it’s six of one and half-dozen of the other, but it seems easier to me. The way to do this, iirc, is to get on the AWT event thread (e.g. using SwingUtilities.invokeLater), change the border of the component, and then revalidate the component’s container.