I’m trying to insert some spacers into a layout on JPanel. I’ve got 3 buttons and I’d like to put something similar to Box.createRigidArea(new Dimension(10, 0)) between them. Netbeans 6.9.1 doesn’t seem to have an option to create them – is that true? Is there some workaround?
I’m trying to insert some spacers into a layout on JPanel . I’ve got
Share
Another approach is to set the
JPanelto useBoxLayoutand modify a button’s Pre- or Post-Adding code to include the desiredComponent:The generated code will look like this:
You’ll also need to
import javax.swing.Box.