/** * 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); } }
/** * Converts the specified mouse event's screen point from WebView coordinates to Windows * coordinates, and returns a new event who's screen point is in Windows coordinates, with the * origin at the upper left corner of the WebView window. * * @param e The event to convert. * @return A new mouse event in the Windows coordinate system. */ protected MouseEvent convertToWindows(MouseEvent e) { int x = e.getX(); int y = e.getY(); // Translate OpenGL screen coordinates to Windows by moving the Y origin from the lower left // corner to // the upper left corner and flipping the direction of the Y axis. y = this.frameSize.height - y; if (e instanceof MouseWheelEvent) { return new MouseWheelEvent( (Component) e.getSource(), e.getID(), e.getWhen(), e.getModifiers(), x, y, e.getClickCount(), e.isPopupTrigger(), ((MouseWheelEvent) e).getScrollType(), ((MouseWheelEvent) e).getScrollAmount(), ((MouseWheelEvent) e).getWheelRotation()); } else { return new MouseEvent( (Component) e.getSource(), e.getID(), e.getWhen(), e.getModifiers(), x, y, e.getClickCount(), e.isPopupTrigger(), e.getButton()); } }
public void mousePressed(MouseEvent e) { if ((e.getModifiers() & java.awt.event.MouseEvent.BUTTON1_MASK) != 0) { this.startX = e.getX(); this.startY = e.getY(); System.out.println(startX); System.out.println(startY); } else if ((e.getModifiers() & java.awt.event.MouseEvent.BUTTON3_MASK) != 0) { panel.popup.show(panel, e.getX(), e.getY()); } }
public static void checkClickedModifiersTest(int testModifier, MouseEvent event) { int[] curStandardModifiers = getStandardArray(testModifier); int[] curStandardExModifiers = getStandardExArray(testModifier); // int index = (button - 4)*3 + 2; int button = event.getButton(); int modifiers = event.getModifiers(); int modifiersEx = event.getModifiersEx(); int index = (button - 1) * 3 + 2; dumpValues( button, modifiers, curStandardModifiers[index], modifiersEx, curStandardExModifiers[index]); if (modifiers != curStandardModifiers[index]) { if (debug) { System.out.println("Test failed : Clicked. modifiers != modifiersStandard"); } else { throw new RuntimeException("Test failed : Clicked. modifiers != modifiersStandard"); } } if (modifiersEx != curStandardExModifiers[index]) { if (debug) { System.out.println("Test failed : Clicked. modifiersEx != curStandardExModifiers"); } else { throw new RuntimeException("Test failed : Clicked. modifiersEx != curStandardExModifiers"); } } HashMap<String, String> paramStringElements = tokenizeParamString(event.paramString()); checkButton(paramStringElements, button); checkModifiers(testModifier, paramStringElements, button); checkExtModifiersOnReleaseClick(testModifier, paramStringElements, button); }
/** * Called to process events. Mouse events will be rewritten to indicate the position in the * document clicked, instead of the position of the panel. * * @param event to process. */ protected void processEvent(AWTEvent event) { try { if (event instanceof MouseEvent) { final Point scrollPosition = getScrollPosition(); if (scrollPosition != null) { final MouseEvent mouseEvent = (MouseEvent) event; event = new MouseEvent( (Component) mouseEvent.getSource(), mouseEvent.getID(), mouseEvent.getWhen(), mouseEvent.getModifiers(), mouseEvent.getX() + scrollPosition.x, mouseEvent.getY() + scrollPosition.y, mouseEvent.getClickCount(), mouseEvent.isPopupTrigger()); } } } catch (final Throwable exp) { exp.printStackTrace(DjVuOptions.err); System.gc(); } super.processEvent(event); }
public void mouseReleased(MouseEvent e) { lastInteractionTime = System.currentTimeMillis(); if (enabled && !readOnly && lastPressEvent != null && dragInProgress) { if (enableMouseDrags && !e.getPoint().equals(lastPressEvent.getPoint())) { dragInProgress = false; // Generate the command string String s = "Mouse " + MouseCommand.MOUSE_DRAG; // Insert the button identifier if other than left button was pressed if (e.getButton() != MouseEvent.BUTTON1) { s += " " + MouseCommand.PARAM_BUTTON_SHORT + "=" + parser.buttonToString(e.getButton()); } // Insert modifiers if there are any String modifiers = parser.modifiersToString(e.getModifiers()); if (modifiers.length() > 0) { s += " " + MouseCommand.PARAM_MODIFIER + "=" + modifiers; } // Generate coordinates s += " " + MouseCommand.PARAM_FROM + "=" + parser.pointToString(lastPressEvent.getPoint()); s += " " + MouseCommand.PARAM_TO + "=" + parser.pointToString(e.getPoint()); // Insert the command to the current editor insertLine(s, false, true, false); insertEvent(e); } } }
public void mouseReleased(MouseEvent e) { int[] mouseCurent = new int[2]; mouseCurent[0] = e.getX(); mouseCurent[1] = e.getY(); if (e.getModifiers() == MouseEvent.BUTTON1_MASK) { double d[][] = plotViewer.plotPanel.plotCanvas.centerData; // plotViewer.plotPanel.addPlot("SCATTER", "Cluster Center", Color.BLACK, d); // increase the center data storage memory if (clickedNum == 0) { cluster2DCenters = new double[1][2]; cluster2DCenters[0] = d[0]; clickedNum++; } else { double bak[][] = new double[clickedNum][2]; bak = copy(cluster2DCenters); clickedNum++; cluster2DCenters = new double[clickedNum][2]; for (int i = 0; i < clickedNum - 1; i++) { cluster2DCenters[i] = copy(bak[i]); } cluster2DCenters[clickedNum - 1] = d[0]; } } }
public void mousePressed(MouseEvent evt) { requestFocus(); // Focus events not fired sometimes? setCaretVisible(true); focusedComponent = JEditTextArea.this; if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) != 0 && popup != null) { popup.show(painter, evt.getX(), evt.getY()); return; } int line = yToLine(evt.getY()); int offset = xToOffset(line, evt.getX()); int dot = getLineStartOffset(line) + offset; switch (evt.getClickCount()) { case 1: doSingleClick(evt, line, offset, dot); break; case 2: // It uses the bracket matching stuff, so // it can throw a BLE try { doDoubleClick(evt, line, offset, dot); } catch (BadLocationException bl) { bl.printStackTrace(); } break; case 3: doTripleClick(evt, line, offset, dot); break; } }
public void mouseMoved(MouseEvent e) { // if (ij==null) return; int sx = e.getX(); int sy = e.getY(); int ox = offScreenX(sx); int oy = offScreenY(sy); flags = e.getModifiers(); setCursor(sx, sy, ox, oy); IJ.setInputEvent(e); Roi roi = imp.getRoi(); if (roi != null && (roi.getType() == Roi.POLYGON || roi.getType() == Roi.POLYLINE || roi.getType() == Roi.ANGLE) && roi.getState() == roi.CONSTRUCTING) { PolygonRoi pRoi = (PolygonRoi) roi; pRoi.handleMouseMove(ox, oy); } else { if (ox < imageWidth && oy < imageHeight) { ImageWindow win = imp.getWindow(); // Cursor must move at least 12 pixels before text // displayed using IJ.showStatus() is overwritten. if ((sx - sx2) * (sx - sx2) + (sy - sy2) * (sy - sy2) > 144) showCursorStatus = true; if (win != null && showCursorStatus) win.mouseMoved(ox, oy); } else IJ.showStatus(""); } }
public void mouseClicked(MouseEvent ev) { Window w = (Window) ev.getSource(); Frame f = null; if (w instanceof Frame) { f = (Frame) w; } else { return; } Point convertedPoint = SwingUtilities.convertPoint(w, ev.getPoint(), getTitlePane()); int state = f.getExtendedState(); if (getTitlePane() != null && getTitlePane().contains(convertedPoint)) { if ((ev.getClickCount() % 2) == 0 && ((ev.getModifiers() & InputEvent.BUTTON1_MASK) != 0)) { if (f.isResizable()) { if ((state & Frame.MAXIMIZED_BOTH) != 0) { f.setExtendedState(state & ~Frame.MAXIMIZED_BOTH); } else { f.setExtendedState(state | Frame.MAXIMIZED_BOTH); } return; } } } }
public void mousePressed(MouseEvent e) { Point p = e.getPoint(); int mods = e.getModifiers(); if (odometer != null) { String output = " (" + p.x + ", " + p.y + ")"; odometer.setText(output); } }
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) { if (gameover) return; if (!blown) { right_clicked = (e.getModifiers() == Event.META_MASK); if (!xy2index(e.getX(), e.getY())) return; drawBlock(buffG, pr, pc, status(pr, pc)); /*if (e.modifiers == Event.ALT_MASK) { showNeighbours(cr,cc,true); return true; }*/ int s = (!hidden[cr][cc] || flagged[cr][cc] ? status(cr, cc) : 7); if (hidden[cr][cc] && e.getModifiers() == Event.META_MASK) s = 5; drawBlock(buffG, cr, cc, s); // paint(getGraphics()); if (getGraphics() != null) getGraphics().drawImage(buff, 0, 0, null); if ((gameover = is_game_over())) { end_game(); } } }
public void mousePressed(MouseEvent e) { if (ctx != null) { // save the current selection set operator prevSetOp = ctx.getSetOperator(tm).getSetOperator(); // set the selection set operator ctx.getSetOperator(tm).setFromInputEventMask(e.getModifiers()); } start = e.getPoint(); current = e.getPoint(); selecting = true; repaint(); }
/** Called by our adapter when the mouse is clicked. */ protected void mouseClicked(MouseEvent evt) { int modifiers = evt.getModifiers(); // if this is a right button click, and we're in piecen placing // mode, generate a PLACE_NOTHING notification instead if (_placingPiecen && (modifiers & MouseEvent.BUTTON3_MASK) != 0) { // stop piecen placement _placingPiecen = false; // clear out any placed piecen because we're placing nothing if (_placedTile != null && _placedTile.piecen != null) { _placedTile.piecen = null; repaintTile(_placedTile); } // tell the controller we're done _ctrl.placeNothing(); } else { // ignore non-button one presses other than cancel piecen // placement if ((modifiers & MouseEvent.BUTTON1_MASK) == 0) { return; } } // if we have a placing tile and it's in a valid position, we want // to dispatch an action letting the controller know that the user // placed it if (_placingTile != null && _validPlacement) { // move the placing tile to the placed tile _placedTile = _placingTile; _placingTile = null; // inherit claims on the placed tile TileUtil.inheritClaims(_tiles, _placedTile); // post the action _ctrl.tilePlaced(_placedTile); // move into placing piecen mode _placingPiecen = true; // recompute our dimensions (which will relayout or repaint) computeDimensions(); } // if we're placing a piecen and the piecen is in a valid position, we // want to let the controller know that the user placed it if (_placingPiecen && _placedTile != null && _placedTile.piecen != null) { _ctrl.piecenPlaced(_placedTile.piecen); // clear out placing piecen mode _placingPiecen = false; } }
public void onMouseClicked(final MouseEvent e) { final ConstraintHitData hitData = findHit(e); if (ConstraintHit.LINE == hitData.getConstraintHit()) { refreshSelection(hitData.getConstraintView(), InputEvent.BUTTON1_MASK == e.getModifiers()); SwingUtilities.invokeLater( new Runnable() { public void run() { hitData.getConstraintView().mouseClicked(e); } }); } }
// {{{ mouseClicked() method @Override public void mouseClicked(MouseEvent evt) { Point p = evt.getPoint(); int row = table.rowAtPoint(p); int column = table.columnAtPoint(p); if (row == -1) return; if (column == 0) { VFSDirectoryEntryTableModel.Entry entry = (VFSDirectoryEntryTableModel.Entry) table.getModel().getValueAt(row, 0); if (FileCellRenderer.ExpansionToggleBorder.isExpansionToggle(entry.level, p.x)) { return; } } if ((evt.getModifiers() & InputEvent.BUTTON1_MASK) != 0 && evt.getClickCount() % 2 == 0) { browser.filesActivated( evt.isShiftDown() ? VFSBrowser.M_OPEN_NEW_VIEW : VFSBrowser.M_OPEN, true); } else if (GUIUtilities.isMiddleButton(evt.getModifiers())) { if (evt.isShiftDown()) table.getSelectionModel().addSelectionInterval(row, row); else table.getSelectionModel().setSelectionInterval(row, row); browser.filesActivated( evt.isShiftDown() ? VFSBrowser.M_OPEN_NEW_VIEW : VFSBrowser.M_OPEN, true); } } // }}}
@Override public void mousePressed(MouseEvent e) { if (!layerMovingAndChangingCurrentEnabled) return; // click, moved from mouseClicked due // to problems with focus and stuff if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) { Point p = e.getPoint(); CPArtwork artwork = controller.getArtwork(); int layerIndex = getLayerNb(p); if (layerIndex >= 0 && layerIndex < artwork.getLayersNb()) { CPLayer layer = artwork.getLayer(layerIndex); if (p.x < eyeW) { artwork.setLayerVisibility(layerIndex, !layer.isVisible()); artwork.finalizeUndo(); } else { artwork.setActiveLayerNumber(layerIndex); artwork.finalizeUndo(); } } } if ((e.getModifiers() & InputEvent.BUTTON1_MASK) != 0) { Dimension d = getSize(); CPArtwork artwork = controller.getArtwork(); Object[] layers = artwork.getLayers(); int layerOver = (d.height - e.getPoint().y) / layerH; if (layerOver < layers.length) { layerDrag = true; layerDragY = e.getPoint().y; layerDragNb = layerOver; repaint(); } } }
void forwardEventToParent(MouseEvent e) { getParent() .dispatchEvent( new MouseEvent( getParent(), e.getID(), e.getWhen(), e.getModifiers(), e.getX(), e.getY(), e.getXOnScreen(), e.getYOnScreen(), e.getClickCount(), e.isPopupTrigger(), MouseEvent.NOBUTTON)); }
public void mouseDragged(MouseEvent e) { int x = e.getX(); int y = e.getY(); xMouse = offScreenX(x); yMouse = offScreenY(y); flags = e.getModifiers(); // IJ.log("mouseDragged: "+flags); if (flags == 0) // workaround for Mac OS 9 bug flags = InputEvent.BUTTON1_MASK; if (Toolbar.getToolId() == Toolbar.HAND || IJ.spaceBarDown()) scroll(x, y); else { IJ.setInputEvent(e); Roi roi = imp.getRoi(); if (roi != null) roi.handleMouseDrag(x, y, flags); } }
@Override public void mouseReleased(MouseEvent evt) { if (evt.getClickCount() % 2 != 0 && !GUIUtilities.isMiddleButton(evt.getModifiers())) return; int row = parentDirectories.locationToIndex(evt.getPoint()); if (row != -1) { Object obj = parentDirectories.getModel().getElementAt(row); if (obj instanceof VFSFile) { VFSFile dirEntry = (VFSFile) obj; if (!GUIUtilities.isPopupTrigger(evt)) { browser.setDirectory(dirEntry.getPath()); if (browser.getMode() == VFSBrowser.BROWSER) focusOnFileView(); } } } }
@Override public void mouseMoved(final EditorMouseEvent e) { if (e.isConsumed() || !myProject.isInitialized() || myProject.isDisposed()) { return; } MouseEvent mouseEvent = e.getMouseEvent(); if (isMouseOverTooltip(mouseEvent.getLocationOnScreen()) || ScreenUtil.isMovementTowards( myPrevMouseLocation, mouseEvent.getLocationOnScreen(), getHintBounds())) { myPrevMouseLocation = mouseEvent.getLocationOnScreen(); return; } myPrevMouseLocation = mouseEvent.getLocationOnScreen(); Editor editor = e.getEditor(); if (editor.getProject() != null && editor.getProject() != myProject) return; PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject); PsiFile psiFile = documentManager.getPsiFile(editor.getDocument()); Point point = new Point(mouseEvent.getPoint()); if (documentManager.isCommitted(editor.getDocument())) { // when document is committed, try to check injected stuff - it's fast int offset = editor.logicalPositionToOffset(editor.xyToLogicalPosition(point)); editor = InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit(editor, psiFile, offset); } LogicalPosition pos = editor.xyToLogicalPosition(point); int offset = editor.logicalPositionToOffset(pos); int selStart = editor.getSelectionModel().getSelectionStart(); int selEnd = editor.getSelectionModel().getSelectionEnd(); myStoredModifiers = mouseEvent.getModifiers(); BrowseMode browseMode = getBrowseMode(myStoredModifiers); cancelPreviousTooltip(); if (browseMode == BrowseMode.None || offset >= selStart && offset < selEnd) { disposeHighlighter(); return; } myTooltipProvider = new TooltipProvider(editor, pos); myTooltipProvider.execute(browseMode); }
/** * Propagates certain mouse events, such as MOUSE_CLICKED, MOUSE_RELEASED etc. to the deepest * component. * * @param e The MouseEvent to be propagated. */ protected void propagateMouseListenerEvent(MouseEvent e) { if (POPUP_IS_MODAL == false) { Component deepestComponent = getDeepestComponent(e.getPoint()); if (deepestComponent != null) { MouseListener[] mouseListeners = deepestComponent.getMouseListeners(); int eventID; // Get the event type eventID = e.getID(); Point pt = e.getPoint(); Point convertedPt = SwingUtilities.convertPoint(glassPane, e.getPoint(), deepestComponent); MouseEvent evt = new MouseEvent( deepestComponent, e.getID(), System.currentTimeMillis(), e.getModifiers(), convertedPt.x, convertedPt.y, e.getClickCount(), e.isPopupTrigger(), e.getButton()); // Distibute the event to the component's listeners. for (int i = 0; i < mouseListeners.length; i++) { // Forward the appropriate mouse event if (eventID == MouseEvent.MOUSE_PRESSED) { mouseListeners[i].mousePressed(evt); } else if (eventID == MouseEvent.MOUSE_RELEASED) { mouseListeners[i].mouseReleased(evt); } else if (eventID == MouseEvent.MOUSE_CLICKED) { mouseListeners[i].mouseClicked(evt); } } } } }
private void dispatchEvent(MouseEvent me) { if (rect != null && rect.contains(me.getX(), me.getY())) { Point pt = me.getPoint(); pt.translate(-offset, 0); comp.setBounds(rect); comp.dispatchEvent( new MouseEvent( comp, me.getID(), me.getWhen(), me.getModifiers(), pt.x, pt.y, me.getClickCount(), me.isPopupTrigger(), me.getButton())); if (!comp.isValid()) container.repaint(); } }
public void mouseReleased(MouseEvent e) { flags = e.getModifiers(); flags &= ~InputEvent.BUTTON1_MASK; // make sure button 1 bit is not set flags &= ~InputEvent.BUTTON2_MASK; // make sure button 2 bit is not set flags &= ~InputEvent.BUTTON3_MASK; // make sure button 3 bit is not set Roi roi = imp.getRoi(); if (roi != null) { Rectangle r = roi.getBounds(); int type = roi.getType(); if ((r.width == 0 || r.height == 0) && !(type == Roi.POLYGON || type == Roi.POLYLINE || type == Roi.ANGLE || type == Roi.LINE) && !(roi instanceof TextRoi) && roi.getState() == roi.CONSTRUCTING && type != roi.POINT) imp.killRoi(); else { roi.handleMouseUp(e.getX(), e.getY()); if (roi.getType() == Roi.LINE && roi.getLength() == 0.0) imp.killRoi(); } } }
public void onMousePressed(final MouseEvent e) { final ConstraintHitData hitData = findHit(e); if (ConstraintHit.LINE == hitData.getConstraintHit()) { _lastPressedConstraintView = hitData.getConstraintView(); if (InputEvent.BUTTON3_MASK == e.getModifiers()) { refreshSelection(hitData.getConstraintView(), false); SwingUtilities.invokeLater( new Runnable() { public void run() { hitData.getConstraintView().mousePressed(e); } }); } else { hitData.getConstraintView().mousePressed(e); } } else if (ConstraintHit.NONE == hitData.getConstraintHit()) { maybeShowPopup(e); } }
public void mouseMoved(final EditorMouseEvent e) { if (e.isConsumed() || !myProject.isInitialized()) { return; } MouseEvent mouseEvent = e.getMouseEvent(); Editor editor = e.getEditor(); if (editor.getProject() != null && editor.getProject() != myProject) return; PsiFile psiFile = PsiDocumentManager.getInstance(myProject).getPsiFile(editor.getDocument()); Point point = new Point(mouseEvent.getPoint()); if (!PsiDocumentManager.getInstance(myProject).isUncommited(editor.getDocument())) { // when document is committed, try to check injected stuff - it's fast editor = InjectedLanguageUtil.getEditorForInjectedLanguageNoCommit( editor, psiFile, editor.logicalPositionToOffset(editor.xyToLogicalPosition(point))); } LogicalPosition pos = editor.xyToLogicalPosition(point); int offset = editor.logicalPositionToOffset(pos); int selStart = editor.getSelectionModel().getSelectionStart(); int selEnd = editor.getSelectionModel().getSelectionEnd(); myStoredModifiers = mouseEvent.getModifiers(); BrowseMode browseMode = getBrowseMode(myStoredModifiers); if (myTooltipProvider != null) { myTooltipProvider.dispose(); } if (browseMode == BrowseMode.None || offset >= selStart && offset < selEnd) { disposeHighlighter(); myTooltipProvider = null; return; } myTooltipProvider = new TooltipProvider(editor, pos); myTooltipProvider.execute(browseMode); }
public void mouseDragged(MouseEvent evt) { mx = evt.getX(); my = evt.getY(); // Check if this is a rectangle drawing drag if ((evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) { // rectx2 = evt.getX(); // recty2 = evt.getY(); } else { rotmat.setIdentity(); rotmat.rotate((float) (my - omy), 'x'); rotmat.rotate((float) (mx - omx), 'y'); for (int i = 0; i < npoint; i++) { SequencePoint sp = (SequencePoint) points.elementAt(i); sp.coord[0] -= centre[0]; sp.coord[1] -= centre[1]; sp.coord[2] -= centre[2]; // Now apply the rotation matrix sp.coord = rotmat.vectorMultiply(sp.coord); // Now translate back again sp.coord[0] += centre[0]; sp.coord[1] += centre[1]; sp.coord[2] += centre[2]; } for (int i = 0; i < 3; i++) { axes[i] = rotmat.vectorMultiply(axes[i]); } omx = mx; omy = my; redrawneeded = true; paint(this.getGraphics()); } return; }
/** * Re-dispatches glass pane mouse events only in case they occur on the security panel. * * @param glassPane the glass pane * @param e the mouse event in question */ private void redispatchMouseEvent(Component glassPane, MouseEvent e) { Point glassPanePoint = e.getPoint(); Point securityPanelPoint = SwingUtilities.convertPoint(glassPane, glassPanePoint, securityPanel); Component component; Point componentPoint; if (securityPanelPoint.y > 0) { component = securityPanel; componentPoint = securityPanelPoint; } else { Container contentPane = callRenderer.getCallContainer().getCallWindow().getFrame().getContentPane(); Point containerPoint = SwingUtilities.convertPoint(glassPane, glassPanePoint, contentPane); component = SwingUtilities.getDeepestComponentAt(contentPane, containerPoint.x, containerPoint.y); componentPoint = SwingUtilities.convertPoint(contentPane, glassPanePoint, component); } if (component != null) component.dispatchEvent( new MouseEvent( component, e.getID(), e.getWhen(), e.getModifiers(), componentPoint.x, componentPoint.y, e.getClickCount(), e.isPopupTrigger())); e.consume(); }
// {{{ mousePressed() method @Override public void mousePressed(MouseEvent evt) { Point p = evt.getPoint(); if (evt.getSource() != table) { p.x -= table.getX(); p.y -= table.getY(); } int row = table.rowAtPoint(p); int column = table.columnAtPoint(p); if (column == 0 && row != -1) { VFSDirectoryEntryTableModel.Entry entry = (VFSDirectoryEntryTableModel.Entry) table.getModel().getValueAt(row, 0); if (FileCellRenderer.ExpansionToggleBorder.isExpansionToggle(entry.level, p.x)) { table.toggleExpanded(row); return; } } if (GUIUtilities.isMiddleButton(evt.getModifiers())) { if (row == -1) /* nothing */ ; else if (evt.isShiftDown()) table.getSelectionModel().addSelectionInterval(row, row); else table.getSelectionModel().setSelectionInterval(row, row); } else if (GUIUtilities.isPopupTrigger(evt)) { if (popup != null && popup.isVisible()) { popup.setVisible(false); popup = null; return; } if (row == -1) showFilePopup(null, table, evt.getPoint()); else { if (!table.getSelectionModel().isSelectedIndex(row)) table.getSelectionModel().setSelectionInterval(row, row); showFilePopup(getSelectedFiles(), table, evt.getPoint()); } } } // }}}