Source:
private void setup() { setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.gridx = 1; c.gridy = 1; c.weightx = 0.0; c.weighty = 0.0; c.insets = new Insets(1, 2, 1, 2); modeLabel = new JLabel(getString(KEY_MODE_TEXT)); ConfigManager manager = getUser().getPreferencesManager(); Font labelFont = manager.getFontValue(KEY_LABEL_FONT, DEFAULT_FONT); labelFont = new JLabel().getFont().deriveFont(labelFont.getStyle(), labelFont.getSize2D()); Font modeFont = manager.getFontValue(KEY_MODE_FONT, DEFAULT_FONT); modeFont = new JLabel().getFont().deriveFont(modeFont.getStyle(), modeFont.getSize2D()); int selectThick = manager.getIntegerValue(KEY_SELECT_THICK, DEFAULT_SELECT_THICK); modeLabel.setFont(labelFont); modeLabel.setForeground(getModeSelectColor()); add(modeLabel, c); oldMode = getUser().getCurrentMode(); for (EntryMode mode : EntryMode.values()) { JLabel label = new JLabel(getString(mode.getI18nKey())); label.setFont(modeFont); label.setForeground(getColorFor(mode)); String modeTooltipKey = "tooltip." + mode.getI18nKey(); String modeTooltipText = getString(modeTooltipKey); if (!modeTooltipKey.equals(modeTooltipText)) { label.setToolTipText(modeTooltipText); } label.setToolTipText(getString("tooltip."+mode.getI18nKey())); setBorderFor(label, mode.equals(oldMode), selectThick); modeMap.put(mode, label); c.gridx++; label.addFocusListener(new FocusAdapter() { private final ModeIndicatorUser user = getUser(); @Override public void focusGained(FocusEvent e) { user.setCurMode(mode); } }); add(label, c); } }

Target:
private void setup() { setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.LINE_START; c.gridx = 1; c.gridy = 1; c.weightx = 0.0; c.weighty = 0.0; c.insets = new Insets(1, 2, 1, 2); modeLabel = new JLabel(getString(KEY_MODE_TEXT)); ConfigManager manager = getUser().getPreferencesManager(); Font labelFont = manager.getFontValue(KEY_LABEL_FONT, DEFAULT_FONT); labelFont = new JLabel().getFont().deriveFont(labelFont.getStyle(), labelFont.getSize2D()); Font modeFont = manager.getFontValue(KEY_MODE_FONT, DEFAULT_FONT); modeFont = new JLabel().getFont().deriveFont(modeFont.getStyle(), modeFont.getSize2D()); int selectThick = manager.getIntegerValue(KEY_SELECT_THICK, DEFAULT_SELECT_THICK); modeLabel.setFont(labelFont); modeLabel.setForeground(getModeSelectColor()); add(modeLabel, c); oldMode = getUser().getCurrentMode(); for (EntryMode mode : EntryMode.values()) { JLabel label = new JLabel(getString(mode.getI18nKey())); label.setFont(modeFont); label.setForeground(getColorFor(mode)); String modeTooltipKey = "tooltip." + mode.getI18nKey(); String modeTooltipText = getString(modeTooltipKey); if (!modeTooltipKey.equals(modeTooltipText)) { label.setToolTipText(modeTooltipText); } setBorderFor(label, mode.equals(oldMode), selectThick); modeMap.put(mode, label); c.gridx++; label.addFocusListener(new FocusAdapter() { private final ModeIndicatorUser user = getUser(); @Override public void focusGained(FocusEvent e) { user.setCurMode(mode); } }); add(label, c); } }