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; } }
void jListOnlineUsers_mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { jTextFieldTargetUser.setText(((HostItem) jListOnlineUsers.getSelectedValue()).name); Flasher.instance().flashBackground(jTextFieldTargetUser, Color.yellow, 2); jTextFieldSendMessages.requestFocus(); } }
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); } } }
/** * 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(); }
/** On double-click, open image properties dialog. */ public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) {} }