protected JPanel getWrapperPanelToFixAlignment(final JLabeledChoice labeledChoice) { // wrap the JLabeledChoice in extra panel to align it on the right final JPanel wrapperPanel = new JPanel(new BorderLayout()); wrapperPanel.add(labeledChoice, BorderLayout.WEST); // fix superfluous outer indents of JLabeledChoice labeledChoice.setLayout(new BoxLayout(labeledChoice, BoxLayout.X_AXIS)); labeledChoice.getComponentList().get(0).setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5)); return wrapperPanel; } }