JComponent () { JPanel wrapper = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); myHighlightRecentlyChanged = new JCheckBox(myCheckboxText); myHighlightInterval = new JSpinner(createSpinnerModel()); wrapper.add(myHighlightRecentlyChanged); wrapper.add(myHighlightInterval); final JLabel days = new JLabel(myMeasure); days.setBorder(JBUI.Borders.empty(0, 1)); wrapper.add(days); myHighlightRecentlyChanged.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { myHighlightInterval.setEnabled(myHighlightRecentlyChanged.isSelected()); } }); return wrapper; }