private void maybeShowGroupPopup(MouseEvent e, JIDStatusGroup jidStatusGroup) { if (e.isPopupTrigger()) { currentJIDStatusGroup = jidStatusGroup; currentGroup = jidStatusGroup.getName(); groupPopupMenu.show(e.getComponent(), e.getX(), e.getY()); } }
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(); } }
public void mousePressed(MouseEvent e) { if (e.getButton() != MouseEvent.BUTTON1) { return; } if (e.getClickCount() != 2) { return; } JTable table = (JTable) e.getSource(); Point p = e.getPoint(); int row = table.rowAtPoint(p); if (row < 0) { return; } PickerTableModel model = getDataModel(); ICFInternetISOCountryObj o = (ICFInternetISOCountryObj) model.getValueAt(row, COLID_ROW_HEADER); invokeWhenChosen.choseISOCountry(o); try { Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { ((JInternalFrame) cont).setClosed(true); } } catch (Exception x) { } }
@Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { doubleClicked((JComponent) e.getSource()); } super.mouseClicked(e); }
public void mousePressed(MouseEvent e) { if (e.getButton() != MouseEvent.BUTTON1) { return; } if (e.getClickCount() != 2) { return; } JTable table = (JTable) e.getSource(); Point p = e.getPoint(); int row = table.rowAtPoint(p); if (row < 0) { return; } FinderTableModel model = getDataModel(); ICFSecurityISOTimezoneObj o = (ICFSecurityISOTimezoneObj) model.getValueAt(row, COLID_ROW_HEADER); if (o == null) { return; } JInternalFrame frame = swingSchema.getISOTimezoneFactory().newViewEditJInternalFrame(o); ((ICFSecuritySwingISOTimezoneJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); if (frame == null) { return; } Container cont = getParent(); while ((cont != null) && (!(cont instanceof JInternalFrame))) { cont = cont.getParent(); } if (cont != null) { JInternalFrame myInternalFrame = (JInternalFrame) cont; myInternalFrame.getDesktopPane().add(frame); frame.setVisible(true); frame.show(); } }
private void MenuPopup (MouseEvent ev, CGNode node) { if (!node.IsConcept()) return; String menuname = (String)menumap.get (node.GetType(true)); if (menuname == null) return; Hashtable templates = (Hashtable)menus.get (menuname); if (templates == null) return; if( popup != null ) remove( popup ); popup = new PopupMenu( menuname ); Enumeration e = templates.keys(); while (e.hasMoreElements()) { String key = (String)e.nextElement(); MenuItem mi = new MenuItem( key ); mi.setActionCommand( key ); mi.addActionListener( this ); popup.add( mi ); } curnode = node; this.add( popup ); popup.show( this, ev.getX(), ev.getY() ); }
public void mouseDragged(MouseEvent e) { int mods = e.getModifiersEx(); Point dragEnd = e.getPoint(); boolean shift = (mods & MouseEvent.SHIFT_DOWN_MASK) > 0; boolean ctrl = (mods & MouseEvent.CTRL_DOWN_MASK) > 0; boolean alt = shift & ctrl; ctrl = ctrl & (!alt); shift = shift & (!alt); boolean nomods = !(shift | ctrl | alt); if (dragBegin == null) dragBegin = dragEnd; nodrag = false; if ((mods & InputEvent.BUTTON3_DOWN_MASK) > 0 || true) { double dx = dragEnd.getX() - dragBegin.getX(); double dy = dragEnd.getY() - dragBegin.getY(); synchronized (JImage.this) { t.preConcatenate(AffineTransform.getTranslateInstance(dx, dy)); } dragBegin = dragEnd; repaint(); } }
public void mouseClicked(MouseEvent e) { int x; int y; e.consume(); if (mouseEventsEnabled) { x = Math.round(e.getX() / scale); y = Math.round(e.getY() / scale); // allow for the canvas margin y -= margin; // System.out.println("Mouse Click: (" + x + ", " + y + ")"); if (e.getClickCount() < 2) { if (nativeSelectItem(x, y)) { parentFTAFrame.updateFrame(); } } else { if (nativeSelectItem(x, y)) { parentFTAFrame.updateFrame(); } editSelected(); parentFTAFrame.updateFrame(); } if (focusEventsEnabled) { // tell the main Canvas to point to this coordinate parentFTAFrame.setCanvasFocus(x, y); } } }
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 leftMouseReleased(MouseEvent e) { double x = e.getX(); double y = e.getY(); // If no start vertex selected or start vertex is virtual, do nothing if (startVertex == null || startVertex.isVirtual()) { displayFrame.controlFrame.updateDisplays(true); return; } endVertex = getSelectedVertex( x, y, displayFrame.getMainDiagramPanel(), displayFrame.getFreeVertexPanel()); // If no end vertex selected, still do nothing if (endVertex == null) { displayFrame.controlFrame.updateDisplays(true); return; } // If mouse pressed and released within the same vertex, print vertex label if (endVertex == startVertex) { canCreateEdge = false; startVertex.setSelected(!startVertex.isSelected()); displayFrame.controlFrame.updateDisplays(true); return; } else { addNewEdge(); } }
@Override public void mousePressed(MouseEvent evt) { // handle.mousePressed(evt); anchor = new Point(evt.getX(), evt.getY()); multicaster.trackStart(anchor, evt.getModifiersEx(), getView()); clearHoverHandles(); }
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()); } }
@Override public void mouseDragged(MouseEvent e) { if (_mousedown != null && _up == null) { _display_offset[0] += e.getX() - _mousedown[0]; _display_offset[1] += e.getY() - _mousedown[1]; _mousedown = new int[] {e.getX(), e.getY()}; } if (_up != null) { if (_up.getType() == BoardObject.type.ROAD) { if (((Road) _up).oneDown == false) { _up.setX(e.getX()); _up.setY(e.getY()); } else { ((Road) _up).setX2(e.getX()); ((Road) _up).setY2(e.getY()); } } else { _up.setX(e.getX() - _up.getW() / 2); _up.setY(e.getY() - _up.getH() / 2); } } repaint(); }
@Override public void mouseMoved(MouseEvent evt) { Point point = evt.getPoint(); updateCursor(editor.findView((Container) evt.getSource()), point); DrawingView view = editor.findView((Container) evt.getSource()); updateCursor(view, point); if (view == null || editor.getActiveView() != view) { clearHoverHandles(); } else { // Search first, if one of the selected figures contains // the current mouse location. Only then search for other // figures. This search sequence is consistent with the // search sequence of the SelectionTool. Figure figure = null; Point2D.Double p = view.viewToDrawing(point); for (Figure f : view.getSelectedFigures()) { if (f.contains(p)) { figure = f; } } if (figure == null) { figure = view.findFigure(point); Drawing drawing = view.getDrawing(); while (figure != null && !figure.isSelectable()) { figure = drawing.findFigureBehind(p, figure); } } updateHoverHandles(view, figure); } }
@Override public final void mousePressed(final MouseEvent e) { if (!isEnabled() || !isFocusable()) return; requestFocusInWindow(); caret(true); if (SwingUtilities.isMiddleMouseButton(e)) copy(); final boolean shift = e.isShiftDown(); final boolean selected = editor.selected(); if (SwingUtilities.isLeftMouseButton(e)) { final int c = e.getClickCount(); if (c == 1) { // selection mode if (shift) editor.startSelection(true); select(e.getPoint(), !shift); } else if (c == 2) { editor.selectWord(); } else { editor.selectLine(); } } else if (!selected) { select(e.getPoint(), true); } }
@Override public void mousePressed(MouseEvent e) { // The mouseMoved event continually updates this variable if (direction == 0) return; // Setup for resizing. All future dragging calculations are done based // on the original bounds of the component and mouse pressed location. resizing = true; Component source = e.getComponent(); pressed = e.getPoint(); SwingUtilities.convertPointToScreen(pressed, source); bounds = source.getBounds(); // Making sure autoscrolls is false will allow for smoother resizing // of components if (source instanceof JComponent) { JComponent jc = (JComponent) source; autoscrolls = jc.getAutoscrolls(); jc.setAutoscrolls(false); } }
/** Handles mouse move events. The event is delegated to the currently active tool. */ public void mouseMoved(MouseEvent e) { try { tool().mouseMove(e, e.getX(), e.getY()); } catch (Throwable t) { handleMouseEventException(t); } }
@Override public void mouseMoved(MouseEvent e) { Component source = e.getComponent(); Point location = e.getPoint(); direction = 0; if (location.x < dragInsets.left) direction += WEST; if (location.x > source.getWidth() - dragInsets.right - 1) direction += EAST; if (location.y < dragInsets.top) direction += NORTH; if (location.y > source.getHeight() - dragInsets.bottom - 1) direction += SOUTH; // Mouse is no longer over a resizable border if (direction == 0) { source.setCursor(sourceCursor); } else // use the appropriate resizable cursor { int cursorType = cursors.get(direction); Cursor cursor = Cursor.getPredefinedCursor(cursorType); source.setCursor(cursor); } }
@Override public final void mousePressed(final MouseEvent e) { if (!isEnabled() || !isFocusable()) return; requestFocusInWindow(); cursor(true); if (SwingUtilities.isMiddleMouseButton(e)) copy(); final boolean marking = e.isShiftDown(); final boolean nomark = !text.marked(); if (SwingUtilities.isLeftMouseButton(e)) { final int c = e.getClickCount(); if (c == 1) { // selection mode if (marking && nomark) text.startMark(); rend.select(scroll.pos(), e.getPoint(), marking); } else if (c == 2) { text.selectWord(); } else { text.selectLine(); } } else if (nomark) { rend.select(scroll.pos(), e.getPoint(), false); } }
public void mouseEvt(MouseEvent evt) { if (evt.isPopupTrigger()) { propDialog.setVisible(true); propDialog.toFront(); evt.consume(); } }
static void handleMouseDragged(MouseEvent e) { DrawObject L = new DrawObject(); L.scribbleX = e.getX(); L.scribbleY = e.getY(); L.scribbleNum = currentScribbleNum; scribbles.add(L); drawArea.repaint(); }
private Location findloc(MouseEvent e) { int i, x = e.getX(), y = e.getY(); if (button.contains(x, y)) return button; for (i = 0; i < NUM_LOCATIONS; i++) { if (locs[i].contains(x, y)) return locs[i]; } return null; }
@Override public void mouseClicked(MouseEvent evt) { if (evt.getClickCount() == 2) { multicaster.trackDoubleClick( new Point(evt.getX(), evt.getY()), evt.getModifiersEx(), getView()); } evt.consume(); }
public void mouseClicked(MouseEvent e) { int selRow = tree.getRowForLocation(e.getX(), e.getY()); TreePath selPath = tree.getPathForLocation(e.getX(), e.getY()); if (e.getClickCount() == 2) { myDoubleClick(selRow, selPath); } }
@Override public final void mouseDragged(final MouseEvent e) { if (!SwingUtilities.isLeftMouseButton(e)) return; // selection mode select(e.getPoint(), false); final int y = Math.max(20, Math.min(e.getY(), getHeight() - 20)); if (y != e.getY()) scroll.pos(scroll.pos() + e.getY() - y); }
/** Handles mouse drag events. The event is delegated to the currently active tool. */ public void mouseDragged(MouseEvent e) { try { Point p = constrainPoint(new Point(e.getX(), e.getY())); tool().mouseDrag(e, p.x, p.y); checkDamage(); } catch (Throwable t) { handleMouseEventException(t); } }
public void mouseDragged(MouseEvent e) { mx = e.getX(); my = e.getY(); // Buttons pauseClicked(); resumeClicked(); musicClicked(); menuClicked(); }
public void mousePressed(MouseEvent e) { int x = e.getX(), y = e.getY(); pressX = lastX = x; pressY = lastY = y; first = findFigureElement(x, y); if (first == null) { point1 = addPoint(x, y); } }
public void mouseReleased(MouseEvent e) { int mods = e.getModifiersEx(); if (nodrag && e.getButton() == MouseEvent.BUTTON3) { popupMenu.show(JImage.this, (int) e.getPoint().getX(), (int) e.getPoint().getY()); } nodrag = true; dragBegin = null; }
/** * Resize the component ensuring location and size is within the bounds of the parent container * and that the size is within the minimum and maximum constraints. * * <p>All calculations are done using the bounds of the component when the resizing started. */ @Override public void mouseDragged(MouseEvent e) { if (resizing == false) return; Component source = e.getComponent(); Point dragged = e.getPoint(); SwingUtilities.convertPointToScreen(dragged, source); changeBounds(source, direction, bounds, pressed, dragged); }