void (final MouseEvent e) { if (balloon.get() != null && balloon.get().isVisible()) { //noinspection SSBasedInspection balloon.get().dispose(); } else { //JLabel pane1 = new JLabel("Hello, world!"); //JLabel pane2 = new JLabel("Hello, again"); //JPanel pane = new JPanel(new BorderLayout()); //pane.add(pane1, BorderLayout.CENTER); //pane.add(pane2, BorderLayout.SOUTH); //pane.setBorder(new LineBorder(Color.blue)); balloon.set(new BalloonImpl( new JLabel("Content"), Color.black, null , MessageType.ERROR.getPopupBackground(), true, true, true, true, true, true, 0, true, false, null, false, 500, 25, 0, 0, false, "This is the title", JBUI.insets(2), true, false, false, Balloon.Layer.normal, false, null, -1)); balloon.get().setShowPointer(true); if (e.isShiftDown()) { balloon.get().show(new RelativePoint(e), Balloon.Position.above); } else if (e.isAltDown()) { balloon.get().show(new RelativePoint(e), Balloon.Position.below); } else if (e.isMetaDown()) { balloon.get().show(new RelativePoint(e), Balloon.Position.atLeft); } else { balloon.get().show(new RelativePoint(e), Balloon.Position.atRight); } } }