/** * 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) { if (e.getClickCount() >= 2) { _table.fireMouseEventForHeader(e, DOUBLECLICK); } else if (e.getClickCount() < 2) { _table.fireMouseEventForHeader(e, CLICKED); } }
/** * Manages mouse clicks * * @param e the event * @see javax.swing.text.DefaultCaret#mouseClicked(java.awt.event.MouseEvent) */ public void mouseClicked(MouseEvent e) { if (SwingUtilities.isMiddleMouseButton(e) && e.getClickCount() == 1) { /** * PASTE USING MIDDLE BUTTON ** */ JTextComponent c = (JTextComponent) e.getSource(); if (c != null) { Toolkit tk = c.getToolkit(); Clipboard buffer = tk.getSystemSelection(); if (buffer != null) { Transferable trans = buffer.getContents(null); if (trans.isDataFlavorSupported(DataFlavor.stringFlavor)) { try { String pastedText = (String) trans.getTransferData(DataFlavor.stringFlavor); ((JTextPane) getConsole().getConfiguration().getInputCommandView()) .replaceSelection(pastedText); } catch (UnsupportedFlavorException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } } } } else if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 1) { /** * SEND THE FOCUS TO THE INPUT COMMAND VIEW ** */ ((JTextPane) getConsole().getConfiguration().getInputCommandView()).requestFocus(); ((JTextPane) getConsole().getConfiguration().getInputCommandView()) .getCaret() .setVisible(true); } else { /** * DELEGATE TO THE SYSTEM ** */ super.mouseClicked(e); } }
@Override @SuppressWarnings({"deprecation", "unchecked"}) // FIXME in Java7 public void mousePressed(MouseEvent e) { if (!enabled && e.getClickCount() == 1 && !e.isConsumed()) { enabled = true; } if (enabled) { JList source = (JList) e.getSource(); if ((e.getButton() == MouseEvent.BUTTON3 || e.isPopupTrigger())) { int index = source.locationToIndex(e.getPoint()); BuildableType type = (BuildableType) source.getModel().getElementAt(index); getGUI().showColopediaPanel(type.getId()); } else if ((e.getClickCount() > 1 && !e.isConsumed())) { DefaultListModel model = (DefaultListModel) buildQueueList.getModel(); if (source.getSelectedIndex() == -1) { source.setSelectedIndex(source.locationToIndex(e.getPoint())); } for (Object type : source.getSelectedValues()) { if (add) { model.addElement(type); } else { model.removeElement(type); } } updateAllLists(); } } }
/** * Mouse CLICKED event handling * * @param e the event * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent) */ public void mouseClicked(MouseEvent e) { // Right click management if ((e.getClickCount() == 1 && SwingUtilities.isRightMouseButton(e)) || e.isPopupTrigger()) { int clickedRow = ((JTable) e.getSource()).rowAtPoint(e.getPoint()); // Does nothing if no variable selected if (clickedRow != -1) { // Right click ? We force the selection of the current row table.setRowSelectionInterval(clickedRow, clickedRow); table.setEditingRow(clickedRow); displayContextMenu(); } } if (e.getClickCount() >= 2) { int clickedRow = ((JTable) e.getSource()).rowAtPoint(e.getPoint()); if (clickedRow != -1) { String variableName = table.getValueAt(clickedRow, BrowseVar.NAME_COLUMN_INDEX).toString(); String variableVisibility = ((JTable) e.getSource()) .getValueAt( ((JTable) e.getSource()).getSelectedRow(), BrowseVar.VISIBILITY_COLUMN_INDEX) .toString(); SwingScilabVariableBrowser.this.startEditVar(variableVisibility, variableName); } } }
public void mousePressed(MouseEvent e) { GridView view = getView(); if (view != null) view.deselectAll(); GridComponent cell = getComponent(e); if (cell == m_comp) { if (!handleControlButton(e)) { GridView childview = m_comp.getChildView(); childview.deselectAll(); if (m_compsrc.isSelectionTool()) { m_comp.setSelected(true); m_comp.repaint(); if (e.getClickCount() > 1) { m_comp.fireGridCellEvent(new GridCellEvent(GridCellEvent.EDIT_COMPONENT, m_comp)); } else if (e.getClickCount() == 1) { setDragSource(this); } } } } else if (cell != null) { CellMouseHandler handler = cell.getMouseHandler(); assert (handler != null); if (handler != null) { handler.mousePressed(e); } m_comp.repaint(); } }
@Override public void mouseClicked(MouseEvent e) { if (myLinkListener.onClick(e, e.getClickCount())) { return; } if (e.getClickCount() == 1 && !expandOrCollapseRoots(e)) { performAction(e, GraphAction.Type.MOUSE_CLICK); } }
public void mouseClicked(MouseEvent e) { if (e.getSource() == jTree1) { int[] selected = jTree1.getSelectionRows(); if (selected.length > 0) { // DefaultMutableTreeNode clicked = // (DefaultMutableTreeNode)jTree1.getModel().getChild(jTree1.getModel().getRoot(), // selected[0]-1); DefaultMutableTreeNode clicked = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent(); if (clicked != null && clicked.getUserObject() instanceof FieldWrapperObjectTree) { FieldWrapperObjectTree wrapper = ((FieldWrapperObjectTree) clicked.getUserObject()); Object ref = getFieldValue(wrapper.getTheField(), wrapper.getOnObject()); if (e.getClickCount() >= 2) { if (ref != null) // ref.getClass().getName().startsWith("scythe.dev") { try { fillTree(clicked, ref); } catch (IllegalArgumentException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (SecurityException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (IllegalAccessException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } jTree1.invalidate(); jTree1.repaint(); } } else if (e.getClickCount() == 1) { if (clicked.getUserObject() instanceof FieldWrapperObjectTree) { FieldWrapperObjectTree fieldWrapper = (FieldWrapperObjectTree) clicked.getUserObject(); this.currEditField = fieldWrapper; fieldEdit.setText( "" + getFieldValue(fieldWrapper.getTheField(), fieldWrapper.getOnObject())); } else { this.currEditField = null; fieldEdit.setText(""); } } } } } }
/* * if(the mouse click is not in the bounds of the tabbed panel) * then call mySingleClick() or myDoubleClick(). * * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent) */ public void mouseClicked(MouseEvent me) { int tab = topLevelTabbedPane.getSelectedIndex(); if (tab != -1) { Rectangle tabBounds = topLevelTabbedPane.getBoundsAt(tab); if (!tabBounds.contains(me.getX(), me.getY())) { return; } if (me.getClickCount() == 1) { mySingleClick(tab); } else if (me.getClickCount() >= 2) { myDoubleClick(tab); } } }
@Override public void mouseClicked(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { if (currentState == EState.NPointsDrawing) { if (e.getClickCount() == 1) { continueDrawing(e.getPoint()); } else if (e.getClickCount() == 2) { finishDraw(); currentState = EState.Idle; repaint(); } } } }
private void jTable6MouseClicked( java.awt.event.MouseEvent evt) { // GEN-FIRST:event_jTable6MouseClicked System.out.println("Count:" + evt.getClickCount()); if (evt.getClickCount() == 2) { String key = (String) jTable6.getModel().getValueAt(jTable6.getSelectedRow(), 5); System.out.println("In Received box double clcik, key:" + key); System.out.println("receivedBoxMap keys:" + receivedBoxMap); String[] row = (String[]) receivedBoxMap.get(key); if (row != null) { new BitcoinTrnDetailsDialog( null, true, new BitcoinAccount(serverID).getLabel(row[3]), key, row[4]) .setVisible(true); } } } // GEN-LAST:event_jTable6MouseClicked
@Override public boolean isCellEditable(EventObject event) { if (event instanceof MouseEvent) { MouseEvent mouseEvent = (MouseEvent) event; if (mouseEvent.getClickCount() == 2) { return false; } if (mouseEvent.getClickCount() == 1 && myTable.rowAtPoint(mouseEvent.getPoint()) == myTable.getSelectedRow() && myTable.columnAtPoint(mouseEvent.getPoint()) == myTable.getSelectedColumn()) { return myProxiedEditor.isCellEditable(null); } } return myProxiedEditor.isCellEditable(event); }
@Override public void mouseClicked(java.awt.event.MouseEvent e) { if (e.getClickCount() == 2) { int linha = table.getSelectedRow(); Evento evento = new Evento(); evento.setId((int) table.getValueAt(linha, 0)); evento.setNome((String) table.getValueAt(linha, 1)); try { Moeda moeda = new Moeda((String) table.getValueAt(linha, 2)); evento.setValor(moeda.getValor()); } catch (ParseException ex) { ex.printStackTrace(); } evento.setDataEvento( AppDate.formatarDataInternacional((String) table.getValueAt(linha, 3))); eventos.add(evento); String nomeEvento, dataEvento, precoEvento; nomeEvento = (String) table.getValueAt(linha, 1); precoEvento = (String) table.getValueAt(linha, 2); dataEvento = (String) table.getValueAt(linha, 3); atualizarValor(precoEvento); adicionarProdutoVendaList(nomeEvento, precoEvento, dataEvento); } }
/** Overriden to pass events on to the tree if the editor does not want to start editing. */ public boolean editCellAt(int row, int column, EventObject e) { if (!super.editCellAt(row, column, e)) { if (e instanceof MouseEvent) { for (int counter = getColumnCount() - 1; counter >= 0; counter--) { if (getColumnClass(counter) == TreeTableModel.class) { MouseEvent me = (MouseEvent) e; MouseEvent newME = new MouseEvent( tree, me.getID(), me.getWhen(), me.getModifiers(), me.getX() - getCellRect(0, counter, true).x, me.getY(), me.getClickCount(), me.isPopupTrigger()); tree.dispatchEvent(newME); break; } } } return false; } return true; }
private void basketTableMousePressed( java.awt.event.MouseEvent evt) { // GEN-FIRST:event_basketTableMousePressed /* When the selected row is double clicked. It is removed from the arraylist and the table is updated. */ JTable selected = (JTable) evt.getSource(); int row = selected.getSelectedRow(); if (evt.getClickCount() == 2) { Inventory.remove(row); updateTable(); } else if (evt.getClickCount() == 1) { Pipes[] specificPipe = Inventory.toArray(new Pipes[Inventory.size()]); pipe = specificPipe[row]; getPipeInfo(); } } // GEN-LAST:event_basketTableMousePressed
public void mouseClicked(MouseEvent e) { Point p = e.getPoint(); int row = appWindow.feedItems.rowAtPoint(p); int column = appWindow.feedItems.columnAtPoint(p); ListFeed channel = (ListFeed) appWindow.channelsList.getSelectedValue(); SyndFeed feed = channel.feed; SyndEntry item = (SyndEntry) feed.getEntries().get(row); if (e.getClickCount() == 2) { // open in browser window } else if (e.getClickCount() == 1) { appWindow.itemDetails.setText(item.getDescription().getValue()); } }
@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 itemClicked(VisualItem item, MouseEvent e) { if (!SwingUtilities.isLeftMouseButton(e)) return; if (e.getClickCount() == 2) { String id = item.getString("id"); BrowserLauncher.showDocument(URL + id); } }
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; } } } }
/** * Mouse Listener Methods Handle double click on the getMulticastGroupConfigTable * * @param e */ public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { JTable target = (JTable) e.getSource(); int row = target.getSelectedRow(); if (e.getSource() != this.multicastConnectivityPanel.getMulticastGroupConfigTable()) { System.err.println("Non standard table"); return; } if (row < 0) { return; } int modelIndex = target.convertRowIndexToModel(row); MulticastGroupConfigModel model = (MulticastGroupConfigModel) target.getModel(); MulticastChannelPairInfo info = model.getMulticastChannelPairInfo(modelIndex); chooseConfiguration(); this.dispose(); } return; }
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; } }
/** Invoked when a mouse button has been released on a component. */ public void mouseReleased(java.awt.event.MouseEvent e) { if ((checkClick) && hadDrag) { int dx = startX - e.getX(); int dy = startY - e.getY(); long cTime = e.getWhen(); if ((dx * dx + dy * dy < MAX_DISP) && (cTime - startTime) < CLICK_TIME) { // our drag was short! dispatch a CLICK event. // MouseEvent click = new MouseEvent( e.getComponent(), MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), // modifiers e.getX(), e.getY(), e.getClickCount(), e.isPopupTrigger()); fakeClickTime = click.getWhen(); handleMouseClicked(click); } } checkClick = false; hadDrag = false; selectInteractor(e); if (interactor != null) { interactor.mouseReleased(e); deselectInteractor(); } else if (eventDispatcher != null) { dispatchMouseReleased(e); } }
@Override public void mouseReleased(MouseEvent e) { Point2D position = e.getPoint(); graphView.transformToUserSpace(position); INode node = graphView.getNodeAtPosition(position, true); if ((e.getButton() == MouseEvent.BUTTON1) && (node != null)) { /* Ako smo pogodili cvor. */ if (e.getClickCount() == 2) { graphModel .getCommandManager() .addCommand(new AddLinkCommand(graphModel, graphView, node, node)); } if ((graphView.getAddingLink() != null) && (node != graphView.getAddingLink().getSource())) { graphModel .getCommandManager() .addCommand( new AddLinkCommand( graphModel, graphView, graphView.getAddingLink().getSource(), node)); } } else { if (graphView.getAddingLink() == null) { graphModel .getStateManager() .changeStateTo(graphModel.getStateManager().getSelectionState()); } } graphView.setAddingLink(null); }
// If the user double clicks on a stock with the LMB, graph the stock. // If the user right clicks over the table, open up a popup menu. private void handleMouseClicked(MouseEvent event) { Point point = event.getPoint(); // Right click on the table - raise menu if (event.getButton() == MouseEvent.BUTTON3) { JPopupMenu menu = new JPopupMenu(); popupGraphSymbols = MenuHelper.addMenuItem(this, menu, Locale.getString("GRAPH")); popupGraphSymbols.setEnabled(getSelectedRowCount() > 0); popupTableSymbols = MenuHelper.addMenuItem(this, menu, Locale.getString("TABLE")); popupTableSymbols.setEnabled(getSelectedRowCount() > 0); menu.show(this, point.x, point.y); } // Left double click on the table - graph stock else if (event.getButton() == MouseEvent.BUTTON1 && event.getClickCount() == 2) { int[] selectedRows = getSelectedRows(); List symbols = new ArrayList(); for (int i = 0; i < selectedRows.length; i++) { Symbol symbol = (Symbol) model.getValueAt(selectedRows[i], EODQuoteModel.SYMBOL_COLUMN); symbols.add(symbol); } // Graph the highlighted symbols CommandManager.getInstance().graphStockBySymbol(symbols); } }
/** * Does exactly the same as actionperformed * * @see java.awt.event.MouseAdapter#mouseClicked(java.awt.event.MouseEvent) */ @SuppressWarnings("unused") public void p(MouseEvent e) { if (e.getClickCount() == 2) { if (dirRadio.isSelected()) browseBySourceDir(); else browseBySourceFile(); } }
public void mouseClicked(MouseEvent e) { if (!(e.getSource().getClass().getName()).equalsIgnoreCase("VisualItem") && !UILib.isButtonPressed(e, button1)) { if (gv.getDisplay().getCursor().getType() == (Cursor.DEFAULT_CURSOR)) { // release all focus and neighbour highlight TupleSet ts = vis.getGroup(Visualization.FOCUS_ITEMS); if (gv.getRecStatus() == 2 && gv.fromIndirect && (ts.getTupleCount() == 0) && !gv.fromAll) gv.showDirectGraph(); ts.clear(); vis.removeGroup("depthEdge"); gv.releaseSearchFocus(); } } if (UILib.isButtonPressed(e, button1) && e.getClickCount() == 1) { if (gv.getDisplay().getCursor().getName().equals("zoom")) admin.toggleZoom(); else if (gv.getDisplay().getCursor().getName().equals("zoomout")) admin.toggleZoomOut(); else if (gv.getDisplay().getCursor().getName().equals("zoomin")) admin.toggleZoomIn(); else if (gv.getDisplay().getCursor().getName().equals("zoomout1")) admin.toggleZoomOut1(); else if (gv.getDisplay().getCursor().getName().equals("zoomin1")) admin.toggleZoomIn1(); else if (gv.getDisplay().getCursor().getName().equals("pan")) admin.togglePan(); } }
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(); } }
public void mouseClicked(MouseEvent e) { // Table => select if (e.getSource() instanceof JTable && e.getClickCount() > 1) { adaptee.m_changed = true; adaptee.dispose(); } }
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 (SwingUtilities.isLeftMouseButton(e) && (e.getClickCount() == 2)) { Point2D point = e.getPoint(); panel.zoom(point, 1); } }