public void mouseReleased(MouseEvent e) { logEvent("MouseReleased", e); // send event to the pressedNode publishMouseEvent( e.getX(), e.getY(), EventBus.getSystem().getPressedNode(), org.joshy.gfx.event.MouseEvent.MouseReleased, e.getButton(), e.isShiftDown(), e.isAltDown(), e.isControlDown(), e.isMetaDown()); // also send event to the top node under the cursor if it's not the pressedNode Node node = findTopNode(e.getX(), e.getY()); if (node != EventBus.getSystem().getPressedNode()) { publishMouseEvent( e.getX(), e.getY(), node, org.joshy.gfx.event.MouseEvent.MouseReleased, e.getButton(), e.isShiftDown(), e.isAltDown(), e.isControlDown(), e.isMetaDown()); } EventBus.getSystem().setPressedNode(null); }
public void mouseMoved(MouseEvent e) { logEvent("MouseMoved", e); Node node = findTopNode(e.getX(), e.getY()); if (node != hoverNode) { if (hoverNode != null) { Point2D point = convertSceneToNode(e.getX(), e.getY(), hoverNode); org.joshy.gfx.event.MouseEvent evt = new org.joshy.gfx.event.MouseEvent( org.joshy.gfx.event.MouseEvent.MouseExited, point.getX(), point.getY(), hoverNode, e.getButton(), e.isShiftDown(), e.isAltDown(), e.isControlDown(), e.isMetaDown()); EventBus.getSystem().publish(evt); } hoverNode = node; if (hoverNode != null) { Point2D point = convertSceneToNode(e.getX(), e.getY(), hoverNode); org.joshy.gfx.event.MouseEvent evt = new org.joshy.gfx.event.MouseEvent( org.joshy.gfx.event.MouseEvent.MouseEntered, point.getX(), point.getY(), hoverNode, e.getButton(), e.isShiftDown(), e.isAltDown(), e.isControlDown(), e.isMetaDown()); EventBus.getSystem().publish(evt); } } Point2D point = convertSceneToNode(e.getX(), e.getY(), node); org.joshy.gfx.event.MouseEvent evt = new org.joshy.gfx.event.MouseEvent( org.joshy.gfx.event.MouseEvent.MouseMoved, point.getX(), point.getY(), node, e.getButton(), e.isShiftDown(), e.isAltDown(), e.isControlDown(), e.isMetaDown()); EventBus.getSystem().publish(evt); }
protected void visibleMouseEvent(MouseEvent e, Point tempPt) { super.visibleMouseEvent(e, tempPt); if (!isEnabled()) return; float curInterval = increment; if (e.isControlDown() != controlDown) { controlDown = e.isControlDown(); startY = tempPt.y; startVal = getValue(); } if (e.isControlDown()) { curInterval /= 5f; } if (mouseInside) { menu.setCursor(Cursor.N_RESIZE_CURSOR); } switch (e.getID()) { case (MouseEvent.MOUSE_PRESSED): if (mouseInside) { if (e.getClickCount() > 1) { setValue(defaultValue); } startY = tempPt.y; startVal = getValue(); scrolling = true; nearestMenu.context.focus().setModalFocus(this.menu); } break; case (MouseEvent.MOUSE_DRAGGED): if (scrolling) { float dy = startY - tempPt.y; float dVal = dy * curInterval * scrollSpeed; value = startVal + dVal; setValue(value); e.consume(); } break; case (MouseEvent.MOUSE_RELEASED): if (scrolling) { e.consume(); scrolling = false; nearestMenu.context.focus().removeFromFocus(this.menu); } break; } }
/** * {@inheritDoc} * * @see swing.gui.AbstractMainPanel#boardClick(java.awt.event.MouseEvent) */ @Override protected void boardClick(final MouseEvent mouseEvent) { final int idX = ((FieldComponent) mouseEvent.getComponent()).getIdX(); final int idY = ((FieldComponent) mouseEvent.getComponent()).getIdY(); if (mouseEvent.getButton() == MouseEvent.BUTTON1 && mouseEvent.isShiftDown()) { // Linke Maustaste + SHIFT = Wert aendern if (getFieldComponent(idX, idY).getValue() < getFieldComponent(idX, idY).getMaxValue()) { getFieldComponent(idX, idY).setValue(getFieldComponent(idX, idY).getValue() + 1); } else { getFieldComponent(idX, idY).setValue(0); } } else if (mouseEvent.getButton() == MouseEvent.BUTTON1 && mouseEvent.isControlDown()) { // Linke Maustaste + STRG = Besitzer aendern if (getFieldComponent(idX, idY).getOwnerId() < GameSession.gameOptions.getMaxPlayers() - 1) { getFieldComponent(idX, idY).setOwner(getFieldComponent(idX, idY).getOwnerId() + 1); } else { getFieldComponent(idX, idY).setOwner(-1); } } else if (mouseEvent.getButton() == MouseEvent.BUTTON1 && mouseEvent.isAltDown()) { // Linke Maustaste + ALT = Reset getFieldComponent(idX, idY).setValue(0); getFieldComponent(idX, idY).setOwner(-1); getFieldComponent(idX, idY).setEnabled(true); } else if (mouseEvent.getButton() == MouseEvent.BUTTON1) { // Linke Maustaste = Aktivieren/Deaktivieren if (getFieldComponent(idX, idY).isEnabled()) { getFieldComponent(idX, idY).setEnabled(false); } else { getFieldComponent(idX, idY).setEnabled(true); } } repaint(); }
/** * 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); } }
@Override public void mouseReleased(java.awt.event.MouseEvent ev) { if (ev.isPopupTrigger() || System.getProperty("os.name") != null && !System.getProperty("os.name").startsWith("Windows") && ev.isControlDown()) { if (CompositeElementPanel.this.getParent() != null) { java.util.Vector structure = edu.cmu.cs.stage3.alice.authoringtool.util.ElementPopupUtilities .getDefaultStructure(m_element); if (!ForEachElementPanel.class.isAssignableFrom(CompositeElementPanel.this.getClass()) && !LoopNElementPanel.class.isAssignableFrom( CompositeElementPanel.this.getClass())) { Runnable dissolveRunnable = new Runnable() { @Override public void run() { dissolve(); } }; edu.cmu.cs.stage3.util.StringObjectPair dissolveEntry = new edu.cmu.cs.stage3.util.StringObjectPair("dissolve", dissolveRunnable); if (structure != null) { structure.add(dissolveEntry); } } if (structure != null) { edu.cmu.cs.stage3.alice.authoringtool.util.ElementPopupUtilities .createAndShowElementPopupMenu( m_element, structure, CompositeElementPanel.this, ev.getX(), ev.getY()); } } } }
@Override public void mousePressed(MouseEvent me) { x = me.getX(); y = me.getY(); altDown = me.isAltDown() || me.isAltGraphDown(); undo = (me.getButton() == MouseEvent.BUTTON3) || altDown; ctrlDown = me.isControlDown() || me.isMetaDown(); shiftDown = me.isShiftDown(); first = true; if (!oneShot) { if (timer == null) { timer = new Timer( delay, e -> { Point worldCoords = view.viewToWorld((int) x, (int) y); tick(worldCoords.x, worldCoords.y, undo, first, 1.0f); view.updateStatusBar(worldCoords.x, worldCoords.y); first = false; }); timer.setInitialDelay(0); timer.start(); // start = System.currentTimeMillis(); } } else { Point worldCoords = view.viewToWorld((int) x, (int) y); tick(worldCoords.x, worldCoords.y, undo, true, 1.0f); view.updateStatusBar(worldCoords.x, worldCoords.y); Dimension dimension = getDimension(); if (dimension != null) { dimension.armSavePoint(); } logOperation(undo ? statisticsKeyUndo : statisticsKey); } }
@Override public boolean handleDataClick(TrackClickEvent te) { MouseEvent e = te.getMouseEvent(); Feature f = getFeatureAtMousePosition(te); // We allow any of these modifier keys for multi-select if (!e.isShiftDown() && !e.isControlDown() && !e.isMetaDown()) { clearSelectedExons(); } boolean foundExon = false; if (f != null && f instanceof IGVFeature) { selectedFeature = (IGVFeature) f; double location = te.getFrame().getChromosomePosition(e.getX()); if (selectedFeature.getExons() != null) { for (Exon exon : selectedFeature.getExons()) { if (location >= exon.getStart() && location < exon.getEnd()) { selectedExons.add(exon); foundExon = true; break; } } } } ((SelectableFeatureRenderer) getRenderer()).setSelectedExons(selectedExons); return foundExon; }
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(); } }
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()); } }
/** Check whether the key used for multiple selections is down. */ private boolean isMultiselectionKeyDown(MouseEvent evt) { if (Config.isMacOS()) { return evt.isShiftDown() || evt.isMetaDown(); } else { return evt.isShiftDown() || evt.isControlDown(); } }
@Override public void itemClicked(VisualItem item, MouseEvent e) { if (!filterCheck(item) || v != item.getVisualization() || !UILib.isButtonPressed(e, button) || e.getClickCount() != ccount) { return; } if (e.isControlDown()) { if (focusedTupleSet.containsTuple(item)) { focusedTupleSet.removeTuple(item); if (item == curFocus) { curFocus = null; Iterator<VisualItem> focusedTuples = focusedTupleSet.tuples(); while (focusedTuples.hasNext()) { curFocus = focusedTuples.next(); } } } else { focusedTupleSet.addTuple(item); curFocus = item; } } else { focusedTupleSet.setTuple(item); curFocus = item; } runActivity(v); }
public void mousePressed(MouseEvent e) { mousePressX = e.getX(); mousePressY = e.getY(); graphPanel .getScaleMode() .init( graphs, (graphPanel.getOverlayState() == true) || (graphPanel.getSelectState() == true) ? graphPanel.getCurrentChannelShowSet() : graphPanel.getChannelShowSet(), graphPanel.getTimeRange(), graphPanel.getMeanState(), getHeight()); // one-button mouse Mac OSX behaviour emulation if (e.getButton() == MouseEvent.BUTTON1) { if (e.isShiftDown()) { button = MouseEvent.BUTTON2; } else if (e.isControlDown()) { button = MouseEvent.BUTTON3; } else { button = MouseEvent.BUTTON1; } } else { button = e.getButton(); } graphPanel.dispatchEvent(SwingUtilities.convertMouseEvent(this, e, graphPanel)); }
// Handle mouse actions public void mousePressed(MouseEvent mouseEvent) { if (this.isArmed() && this.isUseRubberBand() && mouseEvent.getButton() == MouseEvent.BUTTON1) { if ((mouseEvent.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) { if (!mouseEvent.isControlDown()) { this.setActive(true); measureTool.addControlPoint(); if (measureTool.getControlPoints().size() == 1) { measureTool.addControlPoint(); // Simulate a second click } // Set the rubber band target to the last control point or the relevant control for // regular shapes. if (measureTool.isRegularShape()) { String initControl = measureTool.getShapeInitialControl(measureTool.getWwd().getCurrentPosition()); rubberBandTarget = measureTool.getControlPoint(initControl); } else { rubberBandTarget = (MeasureTool.ControlPoint) measureTool.getControlPoints().get(measureTool.getControlPoints().size() - 1); } measureTool.firePropertyChange(MeasureTool.EVENT_RUBBERBAND_START, null, null); } } mouseEvent.consume(); } else if (!this.isArmed() && mouseEvent.getButton() == MouseEvent.BUTTON1 && mouseEvent.isAltDown()) { if (!this.measureTool.isRegularShape()) { this.setMoving(true); this.movingTarget = this.lastPickedObject; } mouseEvent.consume(); } }
public void mousePressed(MouseEvent event) { int x = event.getX() / panel.getZoom(); int y = event.getY() / panel.getZoom(); try { if (event.isControlDown() || SwingUtilities.isRightMouseButton(event)) { // treat right-clicks and control-left-clicks as the same (for Mac users) if (event.isShiftDown()) { list.deleteAll(x, y); } else { list.delete(x, y); } } else { if (event.isShiftDown()) { list.lower(x, y); } else { list.raise(x, y); } } // repaint all of the tiles panel.clear(); Graphics g = panel.getGraphics(); list.drawAll(g); } catch (RuntimeException e) { if (CATCH_EXCEPTIONS) { e.printStackTrace(System.err); } else { throw e; } } }
/** Mouse Listener */ @Override public void mouseClicked(MouseEvent e) { // Show popup if (SwingUtilities.isRightMouseButton(e) || e.isControlDown()) { Point3d coords = gcodeRenderer.getMouseWorldLocation(); this.visualizerPopupMenu.setJogLocation(coords.x, coords.y); this.visualizerPopupMenu.show(e.getComponent(), e.getX(), e.getY()); } }
@Override public void mouseClicked(MouseEvent arg0) { // add or delete a cell when mouse is clicked // translate mouse position to viewport area and register that a new Organism has been spawned // in the viewport.agents array int x = arg0.getXOnScreen() - this.getX(); int y = arg0.getYOnScreen() - this.getY(); // -30 to accommodate the ribbon if (!arg0.isControlDown()) { // add a cell viewport .agents[((int) Math.ceil(((double) x / (double) viewport.scale))) - 1][ ((int) Math.ceil(((double) y / (double) viewport.scale))) - 1] .setAlive(true); } else if (arg0.isControlDown()) { // delete a cell viewport .agents[((int) Math.ceil(((double) x / (double) viewport.scale))) - 1][ ((int) Math.ceil(((double) y / (double) viewport.scale))) - 1] .setAlive(false); // undo a life } }
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; }
/** * @todo Refactor this. Shouldn't mix localisation logic and relation mutation logic in one method * @todo-javadoc Write javadocs for method parameter * @todo-javadoc Write javadocs for method parameter * @todo-javadoc Write javadocs for return value * @todo-javadoc Write javadocs for method parameter * @param evt Describe what the parameter does * @return Describe the return value */ public boolean selectMaybe(MouseEvent evt) { boolean multiplicity = evt.isControlDown(); boolean cardinality = evt.isShiftDown(); Point point = evt.getPoint(); setSelected(_mainLine.intersects(point.getX() - 5, point.getY() - 5, 10, 10)); if (isSelected()) { double distFromP1 = Point2D.distance(_mainLine.getX1(), _mainLine.getY1(), point.getX(), point.getY()); boolean nearP1 = distFromP1 < _mainLength / 2; boolean leftChosen = (_leftIsWest && nearP1) || (!_leftIsWest && !nearP1); RelationshipRole role = leftChosen ? _rightRole : _leftRole; if (multiplicity) { // toggle multiplicity. Let's prevent the user from doing something stupid. Some // cardinalities // can't be changed. we know best etc. if (role.getRelation().isMany2Many()) { // don't allow to change cardinality of m:n relationships JOptionPane.showMessageDialog( null, "Can't change the cardinality of a many-to-many relationship", "Cardinality", JOptionPane.INFORMATION_MESSAGE); return false; } if (role.isFkPk()) { // don't allow to change cardinality of 1:1 relationships that are 1:1 because fk is also // pk JOptionPane.showMessageDialog( null, "Can't change the cardinality of a one-to-one relationship where the foreign key is also a primary key", "Cardinality", JOptionPane.INFORMATION_MESSAGE); return false; } if (role.isTargetPrimaryKey()) { JOptionPane.showMessageDialog( null, "Can't change the cardinality of a the one-side of a relationship that corresponds to a primary key", "Cardinality", JOptionPane.INFORMATION_MESSAGE); return false; } // All checks passed. Do the toggle role.setTargetMany(!role.isTargetMany()); } if (cardinality) { // toggle between uni/bidirectional role.setEnabled(!role.isEnabled()); } return true; } else { return false; } }
@Override public void mouseReleased(MouseEvent arg0) { Object source = arg0.getSource(); if (source.getClass().equals(Case.class)) { // Désélection de(s) la case(s) précédente(s) if (!arg0.isControlDown() && !arg0.isShiftDown()) { if (!casesSelected.isEmpty()) clearSelection(); // Sélection de la nouvelle selectCase((Case) source); indiceShiftSelection[0] = cases.indexOf(((Case) source)); premierShiftOk = true; } else if (arg0.isControlDown()) { if (casesSelected.contains((Case) source)) { casesSelected.remove((Case) source); ((Case) source).setCouleurBordure(Color.darkGray); } else { // Sélection de la nouvelle selectCase((Case) source); } } else if (arg0.isShiftDown()) { if (premierShiftOk) { indiceShiftSelection[1] = cases.indexOf(((Case) source)); if (indiceShiftSelection[0] != indiceShiftSelection[1]) { if (!casesSelected.isEmpty()) clearSelection(); // Sélection de la nouvelle for (int i = Math.min(indiceShiftSelection[0], indiceShiftSelection[1]); i <= Math.max(indiceShiftSelection[0], indiceShiftSelection[1]); i++) selectCase(cases.get(i)); } } else { if (!casesSelected.isEmpty()) clearSelection(); // Sélection de la nouvelle selectCase((Case) source); indiceShiftSelection[0] = casesSelected.indexOf(((Case) source)); premierShiftOk = true; } } } // Mise à jour des observateurs this.updateObservateur(); }
@Override public void mouseClicked(MouseEvent e) { if (UIUtil.isActionClick(e, MouseEvent.MOUSE_CLICKED) && (e.isMetaDown() || (!SystemInfo.isMac && e.isControlDown()))) { final TabInfo info = myTabs.findInfo(e); if (info != null && info.getObject() != null) { final VirtualFile vFile = (VirtualFile) info.getObject(); ShowFilePathAction.show(vFile, e); } } }
private static int applyModifierKeys(MouseEvent event, int cb) { if (event.isControlDown()) { cb |= MouseButtonModifierFlags.MOUSE_BUTTON_CTRL_FLAG; } if (event.isShiftDown()) { cb |= MouseButtonModifierFlags.MOUSE_BUTTON_SHIFT_FLAG; } if ((event.getModifiersEx() & InputEvent.META_MASK) != 0) { cb |= MouseButtonModifierFlags.MOUSE_BUTTON_META_FLAG; } return cb; }
// Handle single click for removing control points public void mouseClicked(MouseEvent mouseEvent) { if (measureTool == null) return; if (this.isArmed() && mouseEvent.getButton() == MouseEvent.BUTTON1) { if (mouseEvent.isControlDown()) measureTool.removeControlPoint(); else if (!this.isUseRubberBand()) { measureTool.addControlPoint(); // Disarm after second control point of a line or regular shape autoDisarm(); } mouseEvent.consume(); } }
public void mouseMoved(MouseEvent e) { int x = e.getX(); int y = e.getY(); graphPanel.cvMouseMoved = true; if ((button != MouseEvent.NOBUTTON) && (e.isControlDown() || e.isShiftDown())) { mouseDragged(e); } else { if (mouseAdapter != null) { mouseAdapter.mouseMoved(x, y, cv); } graphPanel.dispatchEvent(SwingUtilities.convertMouseEvent(this, e, graphPanel)); } }
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()); } } }
@Override public void mousePressed(MouseEvent e) { log.info("pressed: " + e); if (e.getButton() != MouseEvent.BUTTON3) { point1 = e.getPoint(); } ZNode z = findZNodeAt(e.getPoint()); if (z != null) { if (e.isControlDown()) { // new code editor showNewEditor(z); } else if (e.getButton() == MouseEvent.BUTTON1) { draggedNode = z; } } }
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) { int status = getSortingStatus(column); if (!e.isControlDown()) { cancelSorting(); } // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed. status = status + (e.isShiftDown() ? -1 : 1); status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1} setSortingStatus(column, status); } }
public void mouseReleased(MouseEvent e) { if (button != MouseEvent.NOBUTTON && ((mousePressX != e.getX()) || (mousePressY != e.getY()))) { if (button == MouseEvent.BUTTON3 || (button == MouseEvent.BUTTON1 && e.isControlDown() == true)) { if (mouseAdapter != null) { mouseAdapter.mouseReleasedButton3(e.getX(), e.getY(), cv); } } else if (e.getButton() == MouseEvent.BUTTON1) { if (mouseAdapter != null) { mouseAdapter.mouseReleasedButton1(e.getX(), e.getY(), cv); } } } button = MouseEvent.NOBUTTON; graphPanel.dispatchEvent(SwingUtilities.convertMouseEvent(this, e, graphPanel)); }
/** * Check for user's action * * @param event */ public void mousePressed(MouseEvent event) { if (event.getButton() == MouseEvent.BUTTON3 || (event.isControlDown() == true && event.getButton() == MouseEvent.BUTTON1)) { conversationToRemove = listPane.getUserWrapper(listPane.getClickedIndex()).getConversation(); rightClickMenu.show(listPane, event.getX() + 5, event.getYOnScreen()); rightClickMenu.setLocation(event.getXOnScreen(), event.getYOnScreen()); } else if (event.getButton() == MouseEvent.BUTTON1) { controller.setTypingState(1); // set to the default typing state // before rightClickMenu.setVisible(false); // switching controller.changeConversation( listPane.getUserWrapper(listPane.getClickedIndex()).getConversation()); } return; }