private void updateBusy() {
    if (myBusy) {
      if (myBusyIcon == null) {
        myBusyIcon = new AsyncProcessIcon(toString()).setUseMask(false);
        myBusyIcon.setOpaque(false);
        myBusyIcon.setPaintPassiveIcon(false);
        add(myBusyIcon);
      }
    }

    if (myBusyIcon != null) {
      if (myBusy) {
        myBusyIcon.resume();
      } else {
        myBusyIcon.suspend();
        //noinspection SSBasedInspection
        SwingUtilities.invokeLater(
            new Runnable() {
              public void run() {
                if (myBusyIcon != null) {
                  repaint();
                }
              }
            });
      }
      if (myBusyIcon != null) {
        myBusyIcon.updateLocation(this);
      }
    }
  }
 public void mousePressed(final MouseEvent e) {
   if (SwingUtilities.isRightMouseButton(e)) {
     final int[] selectedRows = getSelectedRows();
     if (selectedRows.length < 2) {
       final int row = rowAtPoint(e.getPoint());
       if (row != -1) {
         getSelectionModel().setSelectionInterval(row, row);
       }
     }
   }
 }
  public BalloonHandler notifyByBalloon(
      MessageType type,
      String htmlBody,
      @Nullable Icon icon,
      @Nullable HyperlinkListener listener) {
    final Balloon balloon =
        JBPopupFactory.getInstance()
            .createHtmlTextBalloonBuilder(
                htmlBody.replace("\n", "<br>"),
                icon != null ? icon : type.getDefaultIcon(),
                type.getPopupBackground(),
                listener)
            .createBalloon();

    SwingUtilities.invokeLater(
        new Runnable() {
          @Override
          public void run() {
            Component comp = InfoAndProgressPanel.this;
            if (comp.isShowing()) {
              int offset = comp.getHeight() / 2;
              Point point = new Point(comp.getWidth() - offset, comp.getHeight() - offset);
              balloon.show(new RelativePoint(comp, point), Balloon.Position.above);
            } else {
              final JRootPane rootPane = SwingUtilities.getRootPane(comp);
              if (rootPane != null && rootPane.isShowing()) {
                final Container contentPane = rootPane.getContentPane();
                final Rectangle bounds = contentPane.getBounds();
                final Point target = UIUtil.getCenterPoint(bounds, new Dimension(1, 1));
                target.y = bounds.height - 3;
                balloon.show(new RelativePoint(contentPane, target), Balloon.Position.above);
              }
            }
          }
        });

    return new BalloonHandler() {
      @Override
      public void hide() {
        SwingUtilities.invokeLater(
            new Runnable() {
              @Override
              public void run() {
                balloon.hide();
              }
            });
      }
    };
  }
  public void addNotify() {
    super.addNotify();

    uninstallListeners();

    myWindow = SwingUtilities.getWindowAncestor(this);
    if (myWindow != null) {
      if (myWindow instanceof Frame) {
        setState(((Frame) myWindow).getExtendedState());
      } else {
        setState(0);
      }
      setActive(myWindow.isActive());
      installListeners();
      updateSystemIcon();
    }
  }