/** * 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 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 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 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); } }
@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(); } }
@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); } }
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 void mouseClicked(MouseEvent evt) { if (evt.getClickCount() == 2) { multicaster.trackDoubleClick( new Point(evt.getX(), evt.getY()), evt.getModifiersEx(), getView()); } evt.consume(); }
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; } ListTableModel model = getDataModel(); ICFInternetVersionObj o = (ICFInternetVersionObj) model.getValueAt(row, COLID_ROW_HEADER); if (o == null) { return; } JInternalFrame frame = null; String classCode = o.getClassCode(); if (classCode.equals("VERN")) { frame = swingSchema.getVersionFactory().newViewEditJInternalFrame(o); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ((ICFInternetSwingVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); } else if (classCode.equals("MJVR")) { frame = swingSchema .getMajorVersionFactory() .newViewEditJInternalFrame((ICFInternetMajorVersionObj) o); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ((ICFInternetSwingMajorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); } else if (classCode.equals("MNVR")) { frame = swingSchema .getMinorVersionFactory() .newViewEditJInternalFrame((ICFInternetMinorVersionObj) o); frame.addInternalFrameListener(getViewEditInternalFrameListener()); ((ICFInternetSwingMinorVersionJPanelCommon) frame).setPanelMode(CFJPanel.PanelMode.View); } else { frame = null; } 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(); } }
@Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { JTable table = (JTable) e.getSource(); ListTableModel<PatientModel> tableModel = getTableModel(); PatientModel value = (PatientModel) tableModel.getObject(table.getSelectedRow()); if (value != null) { openKarte(); } } }
@Override public boolean handleMouseClick(Point2D.Double p, MouseEvent evt, DrawingView view) { if (evt.getClickCount() == 2 /* && view.getHandleDetailLevel() == 0*/) { willChange(); // Apply inverse of transform to point if (get(TRANSFORM) != null) { try { p = (Point2D.Double) get(TRANSFORM).inverseTransform(p, new Point2D.Double()); } catch (NoninvertibleTransformException ex) { System.err.println( "Warning: SVGBezierFigure.handleMouseClick. Figure has noninvertible Transform."); } } final int index = splitSegment(p, (float) (5f / view.getScaleFactor())); if (index != -1) { final BezierPath.Node newNode = getNode(index); fireUndoableEditHappened( new AbstractUndoableEdit() { @Override public String getPresentationName() { ResourceBundleUtil labels = ResourceBundleUtil.getBundle("org.jhotdraw.draw.Labels"); return labels.getString("edit.bezierPath.splitSegment.text"); } @Override public void redo() throws CannotRedoException { super.redo(); willChange(); addNode(index, newNode); changed(); } @Override public void undo() throws CannotUndoException { super.undo(); willChange(); removeNode(index); changed(); } }); changed(); evt.consume(); return true; } } return false; }
void this_mouseClicked(MouseEvent e) { if (e.getClickCount() == 1) { int row = this.getSelectedRow(); ItemTableDwnld item = (ItemTableDwnld) getMessageList().get(row); Container parent = (Container) this; while ((parent != null) && !(parent instanceof FrmMain)) parent = parent.getParent(); if (parent != null) { ((FrmMain) parent).setTxtName(item.getTextName()); ((FrmMain) parent).setTxtTextStart(item.getTextStart()); ((FrmMain) parent).setTxtTextEnd(item.getTextEnd()); ((FrmMain) parent).setTxtPath(item.getTextPath()); ((FrmMain) parent).setCboxType(item.getTextType()); ((FrmMain) parent).enableBtnUpDown(row); } } }
@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(); } } } }
/** Handles a mouse click. */ @Override public boolean handleMouseClick(Point2D.Double p, MouseEvent evt, DrawingView view) { if (evt.getClickCount() == 2 && view.getHandleDetailLevel() % 2 == 0) { willChange(); final int index = splitSegment(p, 5f / view.getScaleFactor()); if (index != -1) { final BezierPath.Node newNode = getNode(index); fireUndoableEditHappened( new AbstractUndoableEdit() { private static final long serialVersionUID = 1L; @Override public String getPresentationName() { ResourceBundleUtil labels = ResourceBundleUtil.getBundle("org.jhotdraw.draw.Labels"); return labels.getString("edit.bezierPath.splitSegment.text"); } @Override public void redo() throws CannotRedoException { super.redo(); willChange(); addNode(index, newNode); changed(); } @Override public void undo() throws CannotUndoException { super.undo(); willChange(); removeNode(index); changed(); } }); changed(); evt.consume(); return true; } } return false; }
@Override public void mouseClicked(MouseEvent e) { // TODO Auto-generated method stub if (e.getSource() == table) { if (e.getClickCount() == 2) // 더블클릭 { int row = table.getSelectedRow(); String no = model.getValueAt(row, 0).toString(); bp.setPoster(Integer.parseInt(no)); bp.repaint(); Book book = bm.bookDetail(Integer.parseInt(no)); la1.setText("번호:" + no); la2.setText("제목:" + book.getTitle()); la3.setText("저자:" + book.getAuthor()); la4.setText("출판사:" + book.getPublisher()); la5.setText("가격:" + book.getPrice()); } } else if (e.getSource() == b) { getData(); } }
/** * 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(); }
public void mouseClicked(MouseEvent evt) { // Note: we can't depend on evt.getSource() because of backward // compatability if (list != null && SwingUtilities.isLeftMouseButton(evt) && (evt.getClickCount() % 2 == 0)) { int index = SwingUtilities2.loc2IndexFileList(list, evt.getPoint()); if (index >= 0) { File f = (File) list.getModel().getElementAt(index); try { // Strip trailing ".." f = ShellFolder.getNormalizedFile(f); } catch (IOException ex) { // That's ok, we'll use f as is } if (getFileChooser().isTraversable(f)) { list.clearSelection(); changeDirectory(f); } else { getFileChooser().approveSelection(); } } } }
@Override public void mouseClicked(MouseEvent e) { // TODO Auto-generated method stub if (e.getSource() == table) { if (e.getClickCount() == 2) { int row = table.getSelectedRow(); String sabun = model.getValueAt(row, 0).toString(); EmpDAO dao = new EmpDAO(); EmpDTO d = dao.empDetailData(Integer.parseInt(sabun)); String msg = "사번:" + d.getEmpno() + "\n" + "이름:" + d.getEname() + "\n" + "직위:" + d.getJob() + "\n" + "사수번호:" + d.getMgr() + "\n" + "입사일:" + d.getHiredate().toString() + "\n" + "급여:" + d.getSal() + "\n" + "성과급:" + d.getComm() + "\n" + "부서번호:" + d.getDeptno(); JOptionPane.showMessageDialog(this, msg); } } }
// {{{ 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); } } // }}}
/** * When a MenuElement receives an event from a MouseListener, it should never process the event * directly. Instead all MenuElements should call this method with the event. * * @param event a MouseEvent object */ public void processMouseEvent(MouseEvent event) { int screenX, screenY; Point p; int i, c, j, d; Component mc; Rectangle r2; int cWidth, cHeight; MenuElement menuElement; MenuElement subElements[]; MenuElement path[]; Vector<MenuElement> tmp; int selectionSize; p = event.getPoint(); Component source = event.getComponent(); if ((source != null) && !source.isShowing()) { // This can happen if a mouseReleased removes the // containing component -- bug 4146684 return; } int type = event.getID(); int modifiers = event.getModifiers(); // 4188027: drag enter/exit added in JDK 1.1.7A, JDK1.2 if ((type == MouseEvent.MOUSE_ENTERED || type == MouseEvent.MOUSE_EXITED) && ((modifiers & (InputEvent.BUTTON1_MASK | InputEvent.BUTTON2_MASK | InputEvent.BUTTON3_MASK)) != 0)) { return; } if (source != null) { SwingUtilities.convertPointToScreen(p, source); } screenX = p.x; screenY = p.y; tmp = (Vector<MenuElement>) selection.clone(); selectionSize = tmp.size(); boolean success = false; for (i = selectionSize - 1; i >= 0 && success == false; i--) { menuElement = (MenuElement) tmp.elementAt(i); subElements = menuElement.getSubElements(); path = null; for (j = 0, d = subElements.length; j < d && success == false; j++) { if (subElements[j] == null) continue; mc = subElements[j].getComponent(); if (!mc.isShowing()) continue; if (mc instanceof JComponent) { cWidth = mc.getWidth(); cHeight = mc.getHeight(); } else { r2 = mc.getBounds(); cWidth = r2.width; cHeight = r2.height; } p.x = screenX; p.y = screenY; SwingUtilities.convertPointFromScreen(p, mc); /** * Send the event to visible menu element if menu element currently in the selected path or * contains the event location */ if ((p.x >= 0 && p.x < cWidth && p.y >= 0 && p.y < cHeight)) { int k; if (path == null) { path = new MenuElement[i + 2]; for (k = 0; k <= i; k++) path[k] = (MenuElement) tmp.elementAt(k); } path[i + 1] = subElements[j]; MenuElement currentSelection[] = getSelectedPath(); // Enter/exit detection -- needs tuning... if (currentSelection[currentSelection.length - 1] != path[i + 1] && (currentSelection.length < 2 || currentSelection[currentSelection.length - 2] != path[i + 1])) { Component oldMC = currentSelection[currentSelection.length - 1].getComponent(); MouseEvent exitEvent = new MouseEvent( oldMC, MouseEvent.MOUSE_EXITED, event.getWhen(), event.getModifiers(), p.x, p.y, event.getXOnScreen(), event.getYOnScreen(), event.getClickCount(), event.isPopupTrigger(), MouseEvent.NOBUTTON); currentSelection[currentSelection.length - 1].processMouseEvent(exitEvent, path, this); MouseEvent enterEvent = new MouseEvent( mc, MouseEvent.MOUSE_ENTERED, event.getWhen(), event.getModifiers(), p.x, p.y, event.getXOnScreen(), event.getYOnScreen(), event.getClickCount(), event.isPopupTrigger(), MouseEvent.NOBUTTON); subElements[j].processMouseEvent(enterEvent, path, this); } MouseEvent mouseEvent = new MouseEvent( mc, event.getID(), event.getWhen(), event.getModifiers(), p.x, p.y, event.getXOnScreen(), event.getYOnScreen(), event.getClickCount(), event.isPopupTrigger(), MouseEvent.NOBUTTON); subElements[j].processMouseEvent(mouseEvent, path, this); success = true; event.consume(); } } } }
public void mouseClicked(MouseEvent e) { if (e.getButton() == 1 && e.getClickCount() == 2) { adjustZoom(1, null); } }
public void mousePressed(MouseEvent e) { if (e.getClickCount() == 2) runPlugin(MAIN_INTERFACE); }
@FXML public void tracksViewMouseClicked(MouseEvent evt) { if (evt.getClickCount() == 2) { playSelectedTrack(); } }
public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) invertCM(); updateColors(); }
public void mouseClicked(MouseEvent e) { if (e.getSource() == userList && e.getClickCount() == 2) { int index = userList.locationToIndex(e.getPoint()); if (index > -1) { String userInfo = (String) ((DefaultListModel) userList.getModel()).get(index); link.running = false; userInfo = userInfo.substring(userInfo.indexOf("@") - 1); link = new LeetClient( userInfo.substring(userInfo.indexOf("@") + 1, userInfo.indexOf(":")), Integer.parseInt(userInfo.substring(userInfo.indexOf(":") + 1)), address, directory); link.setPasv(portItem.getState()); link.command = "LIST"; link.start(); } } if (e.getSource() == fileList && e.getClickCount() == 2) { int index = fileList.locationToIndex(e.getPoint()); if (index > -1) { String fileName = (String) ((DefaultListModel) fileList.getModel()).get(index); if (fileName.indexOf(" ") > -1) { fileName = fileName.substring(0, fileName.indexOf(" ")); } link.command = "RETR " + fileName; System.out.println(link.command); } } if (e.getSource() == connectButton) { if (connectButton.getText().equals("Disconnect")) { active.running = false; connectButton.setText("Connect"); } else { active = new LeetActive( serverTextField.getText(), Integer.parseInt(portTextField.getText()), SERVER_PORT); active.setUserName(nameTextField.getText()); active.start(); connectButton.setText("Disconnect"); } } if (e.getSource() == searchInit) { search = new SearchUsers(); search.start(); } if (e.getSource() == searchList && e.getClickCount() == 2) { int index = searchList.locationToIndex(e.getPoint()); if (index > -1) { String fileInfo = (String) ((DefaultListModel) searchList.getModel()).get(index); link.running = false; String userInfo = fileInfo.substring(fileInfo.indexOf("@") + 1); userInfo = userInfo.substring(userInfo.indexOf("@") - 1); fileInfo = fileInfo.substring(0, fileInfo.indexOf("@")); link = new LeetClient( userInfo.substring(userInfo.indexOf("@") + 1, userInfo.indexOf(":")), Integer.parseInt(userInfo.substring(userInfo.indexOf(":") + 1)), address, directory); link.setPasv(portItem.getState()); link.command = "RETR " + fileInfo; link.start(); } } }