void () { MavenProjectsManager mavenProjectManager = MavenProjectsManager.getInstance(myProject); myTree = new SimpleTree() { private final JTextPane myPane = new JTextPane(); { myPane.setOpaque(false); String addIconText = "'+'"; String refreshIconText = "'Reimport'"; String message = MavenProjectBundle.message("maven.navigator.nothing.to.display", addIconText, refreshIconText); int firstEol = message.indexOf("\n"); int addIconMarkerIndex = message.indexOf(addIconText); myPane.replaceSelection(message.substring(0, addIconMarkerIndex)); myPane.insertIcon(AllIcons.General.Add); int refreshIconMarkerIndex = message.indexOf(refreshIconText); myPane.replaceSelection(message.substring(addIconMarkerIndex + addIconText.length(), refreshIconMarkerIndex)); myPane.insertIcon(AllIcons.Actions.Refresh); myPane.replaceSelection(message.substring(refreshIconMarkerIndex + refreshIconText.length())); StyledDocument document = myPane.getStyledDocument(); SimpleAttributeSet centerAlignment = new SimpleAttributeSet(); StyleConstants.setAlignment(centerAlignment, StyleConstants.ALIGN_CENTER); SimpleAttributeSet justifiedAlignment = new SimpleAttributeSet(); StyleConstants.setAlignment(justifiedAlignment, StyleConstants.ALIGN_JUSTIFIED); document.setParagraphAttributes(0, firstEol, centerAlignment, false); document.setParagraphAttributes(firstEol + 2, document.getLength(), justifiedAlignment, false); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (mavenProjectManager.hasProjects()) { return; } myPane.setFont(getFont()); myPane.setBackground(getBackground()); myPane.setForeground(getForeground()); Rectangle bounds = getBounds(); myPane.setBounds(0, 0, bounds.width - 10, bounds.height); Graphics g2 = g.create(bounds.x + 10, bounds.y + 20, bounds.width, bounds.height); try { myPane.paint(g2); } finally { g2.dispose(); } } }; myTree.getEmptyText().clear(); myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); }