I'd love to get a demonstration of how to make this glue thing work; I've been trying to get it to work and nothing happens...
A good example would be implementation of the class CenteringPanel: all it does is get a JComponent and centers it, leaving it unstretched on the center of a window... i tried coding something like that:
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JComponent;
import javax.swing.JPanel;
public class CenteringPanel extends JPanel{
private static final long serialVersionUID = 1L;
public CenteringPanel(JComponent toCenter) {
setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
add(Box.createHorizontalGlue());
add(Box.createVerticalGlue());
add(toCenter);
add(Box.createVerticalGlue());
add(Box.createHorizontalGlue());
}
}