java.awt.event.MouseEvent Java Examples
The following examples show how to use
java.awt.event.MouseEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JCustomExtendedKeyUsage.java From keystore-explorer with GNU General Public License v3.0 | 7 votes |
private void maybeEditCustomExtKeyUsage(MouseEvent evt) { if (evt.getClickCount() > 1) { Point point = new Point(evt.getX(), evt.getY()); int row = jtCustomExtKeyUsages.rowAtPoint(point); if (row != -1) { try { CursorUtil.setCursorBusy(JCustomExtendedKeyUsage.this); jtCustomExtKeyUsages.setRowSelectionInterval(row, row); editSelectedCustomExtKeyUsage(); } finally { CursorUtil.setCursorFree(JCustomExtendedKeyUsage.this); } } } }
Example #2
Source File: ShapesFrame.java From radiance with BSD 3-Clause "New" or "Revised" License | 6 votes |
public ShapesPanel() { this.shapes = new ArrayList<MyShape>(); this.topColor = COLOR_BLUE; this.bottomColor = COLOR_GREEN; this.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { addShape(e.getPoint()); } }); // animate the gradient endpoint colors in an infinite timeline SwingRepaintTimeline.repaintBuilder(this) .addPropertyToInterpolate("topColor", COLOR_BLUE, COLOR_GREEN) .addPropertyToInterpolate("bottomColor", COLOR_GREEN, COLOR_BLUE) .setDuration(1000) .playLoop(RepeatBehavior.REVERSE); }
Example #3
Source File: Screen.java From RipplePower with Apache License 2.0 | 6 votes |
/** * 鼠标放开 */ public void mouseReleased(MouseEvent e) { if (isLock || isClose || !isLoad) { return; } int type = ACTION_UP; int button = e.getButton(); touch.action = type; touch.type = button; touch.pointer = 1; touch.x = e.getX() - tx; touch.y = e.getY() - ty; this.touchX = (int) touch.x; this.touchY = (int) touch.y; this.isDraging = false; try { touchType[type] = false; touchButtonReleased = button; touchButtonPressed = LInput.NO_BUTTON; onTouchUp(touch); } catch (Exception ex) { touchButtonPressed = LInput.NO_BUTTON; touchButtonReleased = LInput.NO_BUTTON; ex.printStackTrace(); } }
Example #4
Source File: MainPanel.java From java-swing-tips with MIT License | 6 votes |
protected EditorGlassPane() { super(); setOpaque(false); setFocusTraversalPolicy(new DefaultFocusTraversalPolicy() { @Override public boolean accept(Component c) { return Objects.equals(c, getEditorTextField()); } }); addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (!getEditorTextField().getBounds().contains(e.getPoint())) { renameTitle.actionPerformed(new ActionEvent(e.getComponent(), ActionEvent.ACTION_PERFORMED, "")); } } }); }
Example #5
Source File: LizziePane.java From lizzie with GNU General Public License v3.0 | 6 votes |
/** Creates a window */ public LizziePane(LizzieMain owner) { // super(owner); // initCompotents(); // input = owner.input; // installInputListeners(); setOpaque(false); addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { Lizzie.frame.getFocus(); } }); }
Example #6
Source File: FileSaver.java From Luyten with Apache License 2.0 | 6 votes |
public FileSaver(JProgressBar bar, JLabel label) { this.bar = bar; this.label = label; final JPopupMenu menu = new JPopupMenu("Cancel"); final JMenuItem item = new JMenuItem("Cancel"); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { setCancel(true); } }); menu.add(item); this.label.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent ev) { if (SwingUtilities.isRightMouseButton(ev) && isExtracting()) menu.show(ev.getComponent(), ev.getX(), ev.getY()); } }); }
Example #7
Source File: LayersLegend.java From MeteoInfo with GNU Lesser General Public License v3.0 | 6 votes |
public void onMousePressed(MouseEvent e) { _mouseDownPos.x = e.getX(); _mouseDownPos.y = e.getY(); MousePos mPos = new MousePos(); mPos.curTop = 0; mPos.inItem = false; _dragNode = getNodeByPosition(e.getX(), e.getY(), mPos); }
Example #8
Source File: Toolbar.java From Logisim with GNU General Public License v3.0 | 6 votes |
@Override public void mousePressed(MouseEvent e) { int mx = e.getX(); int my = e.getY(); int col = (e.getX() - ICON_SEP) / (ICON_WIDTH + ICON_SEP); int row = (e.getY() - ICON_SEP) / (ICON_HEIGHT + ICON_SEP); int x0 = ICON_SEP + col * (ICON_SEP + ICON_WIDTH); int y0 = ICON_SEP + row * (ICON_SEP + ICON_HEIGHT); if (mx >= x0 && mx < x0 + ICON_WIDTH && my >= y0 && my < y0 + ICON_HEIGHT && col >= 0 && col < tools.length && row >= 0 && row < tools[col].length) { toolPressed = tools[col][row]; inTool = true; toolX = x0; toolY = y0; repaint(); } else { toolPressed = null; inTool = false; } }
Example #9
Source File: ERDesignerGraphUI.java From MogwaiERDesignerNG with GNU General Public License v3.0 | 5 votes |
@Override public void mouseDragged(MouseEvent e) { super.mouseDragged(e); ERDesignerGraph theGraph = (ERDesignerGraph) graph; theGraph.setDragging(true); }
Example #10
Source File: ChartPanel.java From visualvm with GNU General Public License v2.0 | 5 votes |
protected void processMouseEvent(MouseEvent e) { if (isSelected()) { e.consume(); action = false; } else { action = true; } super.processMouseEvent(e); }
Example #11
Source File: ColorWellUI.java From pumpernickel with MIT License | 5 votes |
public SingleClickTimer(JColorWell well, int doubleClickThreshold, Long timeStamp, ActionListener actionListener, MouseEvent trigger) { super(doubleClickThreshold, timerListener); this.well = well; this.timeStamp = timeStamp; this.actionListener = actionListener; this.trigger = trigger; setRepeats(false); }
Example #12
Source File: CommentFrame.java From BurpSuite-Team-Extension with GNU General Public License v3.0 | 5 votes |
CommentsPanel(HttpRequestResponse requestResponse, SharedValues sharedValues) { this.sharedValues = sharedValues; commentsList = new JList<>(); commentsList.setCellRenderer(new JPanelListCellRenderer()); commentsList.setModel(new JPanelListModel()); commentsList.addMouseListener( new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { /* Checks to see if it is a right click and if the click point is within the bounds of a Comments borders */ if ( SwingUtilities.isRightMouseButton(e) && commentsList.getCellBounds(commentsList.locationToIndex(e.getPoint()),commentsList.locationToIndex(e.getPoint())).contains(e.getPoint())) { int selectedIndex = commentsList.locationToIndex(e.getPoint()); RequestComment selectedComment = commentsList.getModel().getElementAt(selectedIndex); if (sharedValues.getClient().getUsername().equals(selectedComment.getUserWhoCommented())) { JPopupMenu menu = new JPopupMenu(); JMenuItem itemRemove = new JMenuItem("Delete"); itemRemove.addActionListener(e1 -> { sharedValues.getCallbacks().printOutput( "Deleting comment " + selectedComment); ((JPanelListModel) commentsList.getModel()).removeComment(selectedIndex); sharedValues.getRequestCommentModel().removeCommentFromNewOrExistingReqResp(selectedComment, requestResponse); }); menu.add(itemRemove); menu.show(commentsList, e.getPoint().x, e.getPoint().y); } } } }); setPreferredSize(new Dimension(400, 700)); setViewportView(commentsList); }
Example #13
Source File: TableTabCaret.java From Logisim with GNU General Public License v3.0 | 5 votes |
@Override public void mousePressed(MouseEvent e) { table.requestFocus(); int row = table.getRow(e); int col = table.getColumn(e); setCursor(row, col, (e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0); }
Example #14
Source File: TimelineSelectionManager.java From visualvm with GNU General Public License v2.0 | 5 votes |
public void mouseEntered(final MouseEvent e) { SwingUtilities.invokeLater(new Runnable() { public void run() { inChart = true; mouseX = e.getX(); mouseY = e.getY(); } }); }
Example #15
Source File: PhotoListView.java From java-photoslibrary with Apache License 2.0 | 5 votes |
private JLabel visualizeMediaItem(MediaItem mediaItem) throws MalformedURLException { URL imgSource = new URL(getResizedImageSource(mediaItem.getBaseUrl())); ImageIcon fetchedImage = new ImageIcon(imgSource); JLabel label = new JLabel("", fetchedImage, JLabel.CENTER); final PhotoListView self = this; label.addMouseListener( new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { onItemClicked.accept(self, mediaItem); } }); return label; }
Example #16
Source File: ResultSetTableCellEditor.java From netbeans with Apache License 2.0 | 5 votes |
public ResultSetTableCellEditor(final JTextField textField) { super(textField); delegate = new EditorDelegate() { @Override public void setValue(Object value) { val = value; textField.setText((value != null) ? value.toString() : ""); } @Override public boolean isCellEditable(EventObject evt) { if (evt instanceof MouseEvent) { return ((MouseEvent) evt).getClickCount() >= 2; } return true; } @Override public Object getCellEditorValue() { String txtVal = textField.getText(); if (val == null && txtVal.equals("")) { return null; } else { return txtVal; } } }; textField.addActionListener(delegate); // #204176 - workarround for MacOS L&F textField.setCaret(new DefaultCaret()); }
Example #17
Source File: DatasetTreeView.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
DatasetTreeView() { // the catalog tree tree = new JTree() { public JToolTip createToolTip() { return new MultilineTooltip(); } }; tree.setModel(new DefaultTreeModel(new DefaultMutableTreeNode(null, false))); tree.setCellRenderer(new MyTreeCellRenderer()); tree.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { int selRow = tree.getRowForLocation(e.getX(), e.getY()); if (selRow != -1) { TreeNode node = (TreeNode) tree.getLastSelectedPathComponent(); if (node instanceof VariableNode) { Variable v = ((VariableNode) node).var; firePropertyChangeEvent(new PropertyChangeEvent(this, "Selection", null, v)); } } } }); tree.putClientProperty("JTree.lineStyle", "Angled"); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setToggleClickCount(1); ToolTipManager.sharedInstance().registerComponent(tree); // layout setLayout(new BorderLayout()); add(new JScrollPane(tree), BorderLayout.CENTER); }
Example #18
Source File: ColorPipetteBase.java From darklaf with MIT License | 5 votes |
@Override public void eventDispatched(final AWTEvent event) { if (pickerWindow == null || !pickerWindow.isVisible()) return; switch (event.getID()) { case MouseEvent.MOUSE_PRESSED : ((MouseEvent) event).consume(); pickAndClose(); break; case MouseEvent.MOUSE_CLICKED : ((MouseEvent) event).consume(); break; case KeyEvent.KEY_PRESSED : downKeyCode = ((KeyEvent) event).getKeyCode(); switch (downKeyCode) { case KeyEvent.VK_ESCAPE : cancelPipette(); break; case KeyEvent.VK_ENTER : pickAndClose(); break; default : break; } if (!keyDown) { keyDown = true; updatePipette(true); } break; case KeyEvent.KEY_RELEASED : keyDown = false; Window picker = getPickerWindow(); if (picker != null) { picker.repaint(); } break; default : break; } }
Example #19
Source File: FindInQueryBar.java From netbeans with Apache License 2.0 | 5 votes |
private void processMouseEvent(MouseEvent evt, boolean over) { Object src = evt.getSource(); if (src instanceof JButton) { JButton button = (JButton)src; button.setContentAreaFilled(over); button.setBorderPainted(over); } }
Example #20
Source File: CStateFactory.java From binnavi with Apache License 2.0 | 5 votes |
/** * Creates a new state event object when the edge is clicked with the right mouse button. * * @param e The edge which is clicked. * @param event The mouse event that caused the state change. * * @return The state object that describes the mouse state. */ public IMouseState createEdgeClickedRightState(final Edge e, final MouseEvent event) { final CEdgeClickedRightState<NodeType, EdgeType> state = new CEdgeClickedRightState<NodeType, EdgeType>(this, m_graph, e); m_factory.createEdgeClickedRightAction().execute(state, event); return state; }
Example #21
Source File: ValueModelValueSlider.java From ET_Redux with Apache License 2.0 | 5 votes |
/** * * @param e */ @Override public void mouseReleased(MouseEvent e) { nextX = lastX;//e.getX(); if (mouseInsideValueModelSliderBox) { // recalculate fraction - fire property setValueProperty(currentValue); // june 2017 workaround for broken java 1.8 // mouseInsideValueModelSliderBox = false; } }
Example #22
Source File: TextArea.java From pdfxtk with Apache License 2.0 | 5 votes |
public boolean mouseMovedAction(MouseEvent event) { if (overHandler != null) { context.actionFactory.handleAction(overHandler, null, this, context); return true; } return false; }
Example #23
Source File: ControlListener.java From ProtegeVOWL with MIT License | 5 votes |
/** * mouse-over event on a visual item (node item or edge item) */ @Override public void itemEntered(VisualItem item, MouseEvent e) { // if ctrl is pressed, user zooms -> ignore itemEntered if (e.getModifiers() == InputEvent.CTRL_MASK) { ctrlZoom(e); return; } // only mark items as highlighted if the layout process is active RunLayoutControl rlc = new RunLayoutControl(viewManagerID); if (rlc.isLayouting()) { if (item instanceof NodeItem) { /* set highlight attribute to true, NodeRenderer will change the color */ item.set(ColumnNames.IS_HIGHLIGHTED, true); } if (item instanceof EdgeItem) { /* set highlight attribute to true, EdgeRenderer will change the color */ item.set(ColumnNames.IS_HIGHLIGHTED, true); } if (item instanceof TableDecoratorItem) { /* set highlight attribute to true, EdgeRenderer will change the color */ item.set(ColumnNames.IS_HIGHLIGHTED, true); } } }
Example #24
Source File: FontPanel.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public void mouseReleased( MouseEvent e ) { if ( textToUse == RANGE_TEXT || textToUse == ALL_GLYPHS ) { if ( nowZooming ) zoomWindow.hide(); nowZooming = false; } this.setCursor( Cursor.getDefaultCursor() ); }
Example #25
Source File: bug7170657.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void test(final Frame frame, final MouseEvent me) { MouseEvent newme = SwingUtilities.convertMouseEvent(frame, me, frame); if (me.getModifiersEx() != newme.getModifiersEx() || me.getModifiers() != newme.getModifiers()) { fail(me, newme); } }
Example #26
Source File: RolloverButtonListener.java From radiance with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void mouseDragged(MouseEvent e) { this.stateTransitionTracker.turnOffModelChangeTracking(); try { super.mouseDragged(e); } finally { this.stateTransitionTracker.onModelStateChanged(); } }
Example #27
Source File: InteractiveDoG.java From SPIM_Registration with GNU General Public License v2.0 | 4 votes |
@Override public void mouseClicked(MouseEvent e) {}
Example #28
Source File: NavpointPanel.java From mars-sim with GNU General Public License v3.0 | 4 votes |
public void mouseClicked(MouseEvent event) { checkClick(event); }
Example #29
Source File: SectorSelector.java From hortonmachine with GNU General Public License v3.0 | 4 votes |
public void mouseMoved(MouseEvent e) { }
Example #30
Source File: GridView.java From swift-k with Apache License 2.0 | 4 votes |
@Override public void mouseEntered(MouseEvent e) { }