Sometimes I need the label for a checkbox to be to the left of the checkbox not the right so instead of using
JCheckBox checkbox = new JCheckBox("label",false);
I do:
JCheckBox checkbox = new JCheckBox("",false);
JLabel label = new JLabel("label");
GroupLayout.ParallelGroup vp1 = layout.createBaselineGroup(false, false);
vp1.addComponent(checkbox);
vp1.addComponent(label);
(I am using GroupLayout) but they are not vertically aligned correctly, I've also tried
=layout.createParallelGroup(GroupLayout.Alignment.CENTER);
which doesn't look bad but still appears different to using a single checkbox and various other options, is it possible to get the same alignment ?
you may use the function setHorizontalTextPosition(int textPosition)
with the int value SwingConstants.RIGHT
etc