int (@NotNull JCheckBox cb) { // logic copied from javax.swing.plaf.basic.BasicRadioButtonUI.paint ButtonUI ui = cb.getUI(); Icon buttonIcon = cb.getIcon(); if (buttonIcon == null && ui != null) { if (ui instanceof BasicRadioButtonUI) { buttonIcon = ((BasicRadioButtonUI)ui).getDefaultIcon(); } } return getButtonTextHorizontalOffset(cb, cb.getSize(new Dimension()), buttonIcon); }