Skip to main content

GroupLayout

No replies
rayc
Offline
Joined: 2010-06-26
Points: 0

I have a JFrame containing a JPanel. The JPanel has GroupLayout and a
CustomLayoutStyle class. It contains several components laid out vertically.
At runtime I delete one of the components. After the component is deleted
how can I can get the CustomLayoutStyle getPreferredGap() method automatically
called so that the GUI is refreshed and the vertical gap where the deleted
component was is set to the preferred gap size as returned by getPreferredGap().
I have tried:

 ...
   jPanel1.remove(jTextPane2);
   jPanel1.revalidate();
   jPanel1.repaint();

but the method getPreferredGap() does not get called.