Java Code Examples for javax.swing.SwingUtilities#isLeftMouseButton()
The following examples show how to use
javax.swing.SwingUtilities#isLeftMouseButton() .
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: TableCheckBoxColumn.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 7 votes |
@Override public void mouseClicked(MouseEvent e) { JTableHeader header = (JTableHeader) e.getSource(); JTable table = header.getTable(); TableColumnModel columnModel = table.getColumnModel(); int vci = columnModel.getColumnIndexAtX(e.getX()); int mci = table.convertColumnIndexToModel(vci); if (mci == targetColumnIndex) { if (SwingUtilities.isLeftMouseButton(e)) { TableColumn column = columnModel.getColumn(vci); Object v = column.getHeaderValue(); boolean b = Status.DESELECTED.equals(v); TableModel m = table.getModel(); for (int i = 0; i < m.getRowCount(); i++) { m.setValueAt(b, i, mci); } column.setHeaderValue(b ? Status.SELECTED : Status.DESELECTED); } else if (SwingUtilities.isRightMouseButton(e)) { if (popupMenu != null) { popupMenu.show(table, e.getX(), 0); } } } }
Example 2
Source File: MultiColumnListUI.java From pdfxtk with Apache License 2.0 | 6 votes |
public void mouseDragged(MouseEvent e) { if (!SwingUtilities.isLeftMouseButton(e)) { return; } if (!list.isEnabled()) { return; } if (e.isShiftDown() || e.isControlDown()) { return; } int row = MultiColumnListUI.this.locationToIndex(e.getX(), e.getY()); if (row != -1) { Rectangle cellBounds = getCellBounds(list, row, row); if (cellBounds != null) { list.scrollRectToVisible(cellBounds); list.setSelectionInterval(row, row); } } }
Example 3
Source File: TreePanel.java From chipster with MIT License | 6 votes |
@Override public void mousePressed(MouseEvent e) { maybeShowPopup(e); // double click if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() > 1) { DataItem selectedItem = this.getSelectedElementFrom(e); if (selectedItem instanceof DataBean) { application.visualiseWithBestMethod(FrameType.MAIN); } else if (selectedItem instanceof DataFolder) { // select all child beans DataFolder folder = (DataFolder)selectedItem; application.getSelectionManager().clearAll(false, this); application.getSelectionManager().selectMultiple(folder.getChildren(), this); } } }
Example 4
Source File: EditableHeaderUI.java From chipster with MIT License | 6 votes |
public void mousePressed(MouseEvent e) { if (!SwingUtilities.isLeftMouseButton(e)) { return; } super.mousePressed(e); if (header.getResizingColumn() == null) { Point p = e.getPoint(); TableColumnModel columnModel = header.getColumnModel(); int index = columnModel.getColumnIndexAtX(p.x); if (index != -1) { if (header.editCellAt(index, e)) { setDispatchComponent(e); repostEvent(e); } } } }
Example 5
Source File: FlatTitlePane.java From FlatLaf with Apache License 2.0 | 6 votes |
@Override public void mouseClicked( MouseEvent e ) { if( e.getClickCount() == 2 && SwingUtilities.isLeftMouseButton( e ) ) { if( e.getSource() == iconLabel ) { // double-click on icon closes window close(); } else if( !hasJBRCustomDecoration() && window instanceof Frame && ((Frame)window).isResizable() ) { // maximize/restore on double-click Frame frame = (Frame) window; if( (frame.getExtendedState() & Frame.MAXIMIZED_BOTH) != 0 ) restore(); else maximize(); } } }
Example 6
Source File: ChatboxTextInput.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Override public MouseEvent mouseDragged(MouseEvent mouseEvent) { if (!SwingUtilities.isLeftMouseButton(mouseEvent)) { return mouseEvent; } int nco = getCharOffset(mouseEvent); if (selectionStart != -1) { selectionEnd = nco; cursorAt(selectionStart, selectionEnd); } return mouseEvent; }
Example 7
Source File: GuiMouseListener.java From WorldGrower with GNU General Public License v3.0 | 5 votes |
private boolean isDefaultRightMouseButton(MouseEvent e) { if (keyBindings.leftMouseClickCentersMap()) { return SwingUtilities.isRightMouseButton(e); } else { return SwingUtilities.isLeftMouseButton(e); } }
Example 8
Source File: DragAndDropReorderPane.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void mouseReleased(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { finishDragging(); } }
Example 9
Source File: BBoxSelectionPainter.java From importer-exporter with Apache License 2.0 | 5 votes |
@Override public void mousePressed(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && e.isAltDown()) { start = createGeoRectangle(e.getPoint()); map.setPanEnabled(false); } else start = null; mouseDragged = false; }
Example 10
Source File: UIPredicates.java From audiveris with GNU Affero General Public License v3.0 | 5 votes |
/** * Predicate to check if an additional selection is wanted. * Default is the typical selection (left button), while control key is pressed. * * @param e the mouse context * @return the predicate result */ public static boolean isAdditionWanted (MouseEvent e) { if (WellKnowns.MAC_OS_X) { boolean command = e.isMetaDown(); boolean left = SwingUtilities.isLeftMouseButton(e); return left && command && !e.isPopupTrigger(); } else { return (SwingUtilities.isRightMouseButton(e) != SwingUtilities.isLeftMouseButton(e)) && e.isControlDown(); } }
Example 11
Source File: DeckTablePanel.java From magarena with GNU General Public License v3.0 | 5 votes |
private void doMousePressedAction(MouseEvent e) { if (isMouseRowSelected(e)) { if (SwingUtilities.isLeftMouseButton(e)) { doLeftClickAction(); } else if (SwingUtilities.isRightMouseButton(e)) { doRightClickAction(); } } }
Example 12
Source File: CodeFoldingSideBar.java From netbeans with Apache License 2.0 | 5 votes |
private Mark getClickedMark(MouseEvent e){ if (e == null || !SwingUtilities.isLeftMouseButton(e)) { return null; } int x = e.getX(); int y = e.getY(); for (Mark mark : visibleMarks) { if (x >= mark.x && x <= (mark.x + mark.size) && y >= mark.y && y <= (mark.y + mark.size)) { return mark; } } return null; }
Example 13
Source File: TimelinePanel.java From netbeans with Apache License 2.0 | 5 votes |
public void mouseDragged(MouseEvent e){ if (!SwingUtilities.isLeftMouseButton(e)) return; if (draggingRow != null) { boolean checkStep = (e.getModifiers() & Toolkit.getDefaultToolkit(). getMenuShortcutKeyMask()) == 0; chart.setRowHeight(draggingRow.getIndex(), baseHeight + e.getY() - baseY, checkStep); } }
Example 14
Source File: PanelActionListener.java From nanoleaf-desktop with MIT License | 5 votes |
@Override public void mouseDragged(MouseEvent e) { if (mouseLast != null) { if (SwingUtilities.isLeftMouseButton(e)) { movePanelsUsingMouse(e.getPoint()); } else if (SwingUtilities.isRightMouseButton(e)) { rotatePanelsUsingMouse(e.getPoint()); } } }
Example 15
Source File: ExplorerContentPanel.java From magarena with GNU General Public License v3.0 | 5 votes |
@Override public void mouseReleased(MouseEvent e) { super.mouseReleased(e); // double-click actions. if (e.getClickCount() > 1 && SwingUtilities.isLeftMouseButton(e)) { showCardScriptScreen(); } }
Example 16
Source File: ZoomPainter.java From importer-exporter with Apache License 2.0 | 5 votes |
@Override public void mousePressed(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && e.isShiftDown()) { start = new Rectangle(e.getPoint()); map.setPanEnabled(false); } else start = null; }
Example 17
Source File: ProfilerTabbedPane.java From visualvm with GNU General Public License v2.0 | 5 votes |
protected void processMouseEvent(MouseEvent e) { int index = indexAtLocation(e.getX(), e.getY()); if (index != -1) { if (e.isPopupTrigger()) { // Show popup menu for the clicked tab final MouseEvent _e = e; final int _index = index; final Component _component = getComponentAt(index); SwingUtilities.invokeLater(new Runnable() { public void run() { showPopupMenu(_index, _component, _e); }; }); e.consume(); return; } else if (e.getID() == MouseEvent.MOUSE_CLICKED && SwingUtilities.isMiddleMouseButton(e)) { // Close tab using middle button click if (isClosableAt(index)) closeTab(getComponentAt(index)); e.consume(); return; } else if (e.getID() == MouseEvent.MOUSE_PRESSED && !SwingUtilities.isLeftMouseButton(e)) { // Do not switch tabs using middle or right mouse button e.consume(); return; } } super.processMouseEvent(e); }
Example 18
Source File: CommentsPanel.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void mouseClicked(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { setState(!isCollapsed(number)); } }
Example 19
Source File: ExplorerComponent.java From visualvm with GNU General Public License v2.0 | 4 votes |
public void mouseClicked(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == explorerTree.getToggleClickCount()) { performDefaultAction(); } }
Example 20
Source File: JavaWindowsView.java From visualvm with GNU General Public License v2.0 | 4 votes |
public void mouseClicked(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) handleClick(e); if (SwingUtilities.isMiddleMouseButton(e)) handleMiddleClick(e); }