JComponent () { final JPanel labelPanel = new JPanel(new BorderLayout()); labelPanel.setBackground(RenderingUtil.getBackground(myTree)); final LinkLabel<String> linkLabel = new LinkLabel<>(DvcsBundle.message("push.edit.all.targets"), null); linkLabel.setBorder(JBUI.Borders.empty(2)); linkLabel.setListener((aSource, aLinkData) -> { if (linkLabel.isEnabled()) { startSyncEditing(); } }, null); myTree.addPropertyChangeListener(PushLogTreeUtil.EDIT_MODE_PROP, evt -> { Boolean editMode = (Boolean)evt.getNewValue(); linkLabel.setEnabled(!editMode); linkLabel.setPaintUnderline(!editMode); linkLabel.repaint(); }); labelPanel.add(linkLabel, BorderLayout.EAST); return labelPanel; }