コード例 #1
0
  /**
   * Invoked when a mouse button has been pressed and released on a component
   *
   * @param e the mouse event
   */
  public void mouseClicked(MouseEvent e) {
    int col;
    boolean popup;

    col = m_TableArff.columnAtPoint(e.getPoint());
    popup =
        ((e.getButton() == MouseEvent.BUTTON3) && (e.getClickCount() == 1))
            || ((e.getButton() == MouseEvent.BUTTON1)
                && (e.getClickCount() == 1)
                && e.isAltDown()
                && !e.isControlDown()
                && !e.isShiftDown());
    popup = popup && (getInstances() != null);

    if (e.getSource() == m_TableArff.getTableHeader()) {
      m_CurrentCol = col;

      // Popup-Menu
      if (popup) {
        e.consume();
        setMenu();
        initPopupMenus();
        m_PopupHeader.show(e.getComponent(), e.getX(), e.getY());
      }
    } else if (e.getSource() == m_TableArff) {
      // Popup-Menu
      if (popup) {
        e.consume();
        setMenu();
        initPopupMenus();
        m_PopupRows.show(e.getComponent(), e.getX(), e.getY());
      }
    }

    // highlihgt column
    if ((e.getButton() == MouseEvent.BUTTON1)
        && (e.getClickCount() == 1)
        && (!e.isAltDown())
        && (col > -1)) {
      m_TableArff.setSelectedColumn(col);
    }
  }