If you consolidate your layout code into a method, you can do some
neat things like the following that adds a titled border to all added
comps that includes the general GBC info. The titled border will add
a line around the components as well, showing the boundries of
everything.
public static Component set(Container cont, JComponent comp,
int x, int y, int w, int h,
double wx, double wy,
int top, int left, int bottom, int
right,
int fill, int anchor)
{
GridBagLayout gbl = getLayout( cont );
clearGridBagConstraints();
gbc.fill = fill;
gbc.gridx = x;
gbc.gridy = y;
gbc.gridwidth = w;
gbc.gridheight = h;
gbc.weightx = wx;
gbc.weighty = wy;
gbc.insets = setInsets(ins, top, left, bottom, right);
gbc.anchor = anchor;
comp.setBorder( BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder(
"x="+x+
" y="+y+
" w="+w+
" h="+h ) ),
comp.getBorder() ) );
cont.add(comp, gbc);
return comp;
}