Exemplo n.º 1
0
  /**
   * A chat room was selected. Opens the chat room in the chat window.
   *
   * @param e the <tt>MouseEvent</tt> instance containing details of the event that has just
   *     occurred.
   */
  public void mousePressed(MouseEvent e) {
    // Select the object under the right button click.
    if ((e.getModifiers() & InputEvent.BUTTON2_MASK) != 0
        || (e.getModifiers() & InputEvent.BUTTON3_MASK) != 0
        || (e.isControlDown() && !e.isMetaDown())) {
      int ix = this.chatRoomList.rowAtPoint(e.getPoint());

      if (ix != -1) {
        this.chatRoomList.setRowSelectionInterval(ix, ix);
      }
    }

    Object o = this.chatRoomsTableModel.getValueAt(this.chatRoomList.getSelectedRow());

    Point selectedCellPoint = e.getPoint();

    SwingUtilities.convertPointToScreen(selectedCellPoint, chatRoomList);

    if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0) {
      JPopupMenu rightButtonMenu;

      if (o instanceof ChatRoomWrapper)
        rightButtonMenu = new ChatRoomRightButtonMenu((ChatRoomWrapper) o);
      else return;

      rightButtonMenu.setInvoker(this);
      rightButtonMenu.setLocation(selectedCellPoint);
      rightButtonMenu.setVisible(true);
    }
  }
Exemplo n.º 2
0
 /**
  * Listens for double clicks to open the chat room.
  *
  * @param e
  */
 public void mouseClicked(MouseEvent e) {
   if (((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) && (e.getClickCount() > 1))
     openChatForSelection();
 }