javax.swing.SwingUtilities#isLeftMouseButton ( )源码实例Demo

下面列出了javax.swing.SwingUtilities#isLeftMouseButton ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: pdfxtk   文件: MultiColumnListUI.java
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);
}
     }
   }
 
源代码2 项目: chipster   文件: TreePanel.java
@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);
  		}
  	} 
  }
 
源代码3 项目: chipster   文件: EditableHeaderUI.java
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); 
			}
		}
	}
}
 
@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);
            }
        }
    }
}
 
源代码5 项目: FlatLaf   文件: FlatTitlePane.java
@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();
		}
	}
}
 
源代码6 项目: runelite   文件: ChatboxTextInput.java
@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;
}
 
源代码7 项目: netbeans   文件: TimelinePanel.java
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);
    }
}
 
源代码8 项目: visualvm   文件: ProfilerTabbedPane.java
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);
}
 
源代码9 项目: importer-exporter   文件: ZoomPainter.java
@Override
public void mousePressed(MouseEvent e) {
	if (SwingUtilities.isLeftMouseButton(e) && e.isShiftDown()) {
		start = new Rectangle(e.getPoint());
		map.setPanEnabled(false);
	} else
		start = null;
}
 
源代码10 项目: magarena   文件: ExplorerContentPanel.java
@Override
public void mouseReleased(MouseEvent e) {
    super.mouseReleased(e);
    // double-click actions.
    if (e.getClickCount() > 1 && SwingUtilities.isLeftMouseButton(e)) {
        showCardScriptScreen();
    }
}
 
源代码11 项目: nanoleaf-desktop   文件: PanelActionListener.java
@Override
public void mouseDragged(MouseEvent e)
{
	if (mouseLast != null)
	{
		if (SwingUtilities.isLeftMouseButton(e))
		{
			movePanelsUsingMouse(e.getPoint());
		}
		else if (SwingUtilities.isRightMouseButton(e))
		{
			rotatePanelsUsingMouse(e.getPoint());
		}
	}
}
 
源代码12 项目: WorldGrower   文件: GuiMouseListener.java
private boolean isDefaultRightMouseButton(MouseEvent e) {
	if (keyBindings.leftMouseClickCentersMap()) {
		return SwingUtilities.isRightMouseButton(e);
	} else {
		return SwingUtilities.isLeftMouseButton(e);
	}
}
 
源代码13 项目: netbeans   文件: CodeFoldingSideBar.java
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;
}
 
源代码14 项目: magarena   文件: DeckTablePanel.java
private void doMousePressedAction(MouseEvent e) {
    if (isMouseRowSelected(e)) {
        if (SwingUtilities.isLeftMouseButton(e)) {
            doLeftClickAction();
        } else if (SwingUtilities.isRightMouseButton(e)) {
            doRightClickAction();
        }
    }
}
 
源代码15 项目: audiveris   文件: UIPredicates.java
/**
 * 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();
    }
}
 
源代码16 项目: importer-exporter   文件: BBoxSelectionPainter.java
@Override
public void mousePressed(MouseEvent e) {
	if (SwingUtilities.isLeftMouseButton(e) && e.isAltDown()) {
		start = createGeoRectangle(e.getPoint());
		map.setPanEnabled(false);
	} else
		start = null;

	mouseDragged = false;
}
 
源代码17 项目: runelite   文件: DragAndDropReorderPane.java
@Override
public void mouseReleased(MouseEvent e)
{
	if (SwingUtilities.isLeftMouseButton(e))
	{
		finishDragging();
	}
}
 
源代码18 项目: netbeans   文件: CommentsPanel.java
@Override
public void mouseClicked(MouseEvent e) {
    if (SwingUtilities.isLeftMouseButton(e)) {
        setState(!isCollapsed(number)); 
    } 
}
 
源代码19 项目: visualvm   文件: ExplorerComponent.java
public void mouseClicked(MouseEvent e) {
    if (SwingUtilities.isLeftMouseButton(e) &&
            e.getClickCount() == explorerTree.getToggleClickCount()) {
        performDefaultAction();
    }
}
 
源代码20 项目: visualvm   文件: JavaWindowsView.java
public void mouseClicked(MouseEvent e) {
    if (SwingUtilities.isLeftMouseButton(e)) handleClick(e);
    if (SwingUtilities.isMiddleMouseButton(e)) handleMiddleClick(e);
}