private void adjustFocusAndSelection(MouseEvent e) { if (shouldIgnore(e)) { return; } Point p = e.getPoint(); int row = grid.rowAtPoint(p); int column = grid.columnAtPoint(p); // The autoscroller can generate drag events outside range. if ((column == -1) || (row == -1)) { System.err.println("Out of bounds"); return; } if (grid.editCellAt(row, column, e)) { setDispatchComponent(e); repostEvent(e); } else { grid.requestFocus(); } GridCellEditor editor = grid.getCurrentCellEditor(); if (editor == null || editor.shouldSelectCell(e)) { // Update selection model setValueIsAdjusting(true); grid.changeSelection(row, column, e.isControlDown(), e.isShiftDown()); } }
public void mouseClicked(MouseEvent e) { JTableHeader h = (JTableHeader) e.getSource(); TableColumnModel columnModel = h.getColumnModel(); int viewColumn = columnModel.getColumnIndexAtX(e.getX()); int column = columnModel.getColumn(viewColumn).getModelIndex(); if (column != -1) { sorting_column = column; // 0 == priority icon column // 4 == priority text column if (column == 0) sorting_column = 4; if (e.isControlDown()) sorting_column = -1; else opposite = !opposite; TaskTable treetable = ((TaskTable) h.getTable()); // java.util.Collection expanded = treetable.getExpandedTreeNodes(); treetable.tableChanged(); // treetable.setExpandedTreeNodes(expanded); // h.updateUI(); h.resizeAndRepaint(); } }
/** * 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); } }
public void mouseDragged(MouseEvent e) { int m = e.getModifiers(); int type = DnDEvent.DND_ONE; if (e.isControlDown()) type = DnDEvent.DND_LINE; else if (((m & InputEvent.BUTTON2_MASK) != 0) || ((m & InputEvent.BUTTON3_MASK) != 0)) type = DnDEvent.DND_END; if (startPoint == null) startPoint = new Point(e.getX(), e.getY()); fireDragToolbar(e.getX() - startPoint.x, (e.getY() - startPoint.y), type); dragging = true; }
public void mousePressed(MouseEvent e) { // jdf if (!isEnabled()) return; final int x = e.getX(); final int y = e.getY(); int sel = findSelection(x, y); ///if (sel == -1) return false; if (sel == -1) return; currentRollover = -1; switch (sel) { case RUN: editor.handleRun(e.isShiftDown()); break; // case STOP: // editor.handleStop(); // break; // case OPEN: popup = menu.getPopupMenu(); popup.show(EditorToolbar.this, x, y); break; case NEW: if (shiftPressed) { editor.base.handleNew(); } else { editor.base.handleNewReplace(); } break; case SAVE: editor.handleSave(false); break; case EXPORT: boolean t = e.isControlDown(); editor.handleExport(e.isShiftDown(),autoOpenSerialMonitor ? !t : t); // Control is down if autoOpenSerialMonitor is true in preferences break; case SERIAL: editor.handleSerial(); handleMouse(e); break; } }
@Override public void mousePressed(MouseEvent e) { Object o = e.getSource(); if (o instanceof TableCellEditor) { actionPerformed(null); } else if (o instanceof JButton) { // DEBUG: view button click -> control key down + edit button(same cell) press -> remain // selection color ButtonModel m = ((JButton) e.getComponent()).getModel(); if (m.isPressed() && table.isRowSelected(table.getEditingRow()) && e.isControlDown()) { setBackground(table.getBackground()); } } }
public void mousePressed(MouseEvent e) { // needed for MouseListener interface if (e.isControlDown()) getEditor().toggleListSelected(); // mouseLeftButtonDown = true; getEditor().nodeSelected(this); }