List of usage examples for com.intellij.openapi.wm StatusBar fireNotificationPopup
void fireNotificationPopup(@NotNull JComponent content, Color backgroundColor);
From source file:com.kstenschke.referencer.utils.UtilsEnvironment.java
License:Apache License
/** * @param message//from w w w .ja va 2 s. com */ public static void notify(String message) { Project project = UtilsEnvironment.getOpenProject(); final StatusBar statusBar = WindowManager.getInstance().getStatusBar(project); if (statusBar != null) { // Create notification message UI final JPanel panel = new JPanel(); panel.setOpaque(false); if (message.contains("\n")) { String[] messageLines = message.split("\n"); for (String curLine : messageLines) { panel.add(new JBLabel(curLine)); } panel.setSize(new Dimension(panel.getWidth(), messageLines.length * 16)); } else { JBLabel label = new JBLabel(); label.setText(message); panel.add(label); panel.setSize(new Dimension(panel.getWidth(), 16)); } // Run notification thread Thread statusBarNotifyThread = new Thread() { public void run() { try { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { statusBar.fireNotificationPopup(panel, JBColor.WHITE); } }); } catch (Exception e) { e.printStackTrace(); } // System.out.println("Finished on " + Thread.currentThread()); } }; statusBarNotifyThread.start(); } }