当前位置: 首页>>代码示例>>Java>>正文


Java SwingUtilities.isRightMouseButton方法代码示例

本文整理汇总了Java中javax.swing.SwingUtilities.isRightMouseButton方法的典型用法代码示例。如果您正苦于以下问题:Java SwingUtilities.isRightMouseButton方法的具体用法?Java SwingUtilities.isRightMouseButton怎么用?Java SwingUtilities.isRightMouseButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.SwingUtilities的用法示例。


在下文中一共展示了SwingUtilities.isRightMouseButton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mouseReleased

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mouseReleased(final MouseEvent e) {
  this.setLocation(e);
  this.setPressed(false);
  final MouseEvent wrappedEvent = this.createEvent(e);
  this.mouseListeners.forEach(listener -> listener.mouseReleased(wrappedEvent));

  if (SwingUtilities.isLeftMouseButton(e)) {
    this.isLeftMouseButtonDown = false;
  }

  if (SwingUtilities.isRightMouseButton(e)) {
    this.isRightMouseButtonDown = false;
  }

  for (final Consumer<MouseEvent> cons : this.mouseReleasedConsumer) {
    cons.accept(wrappedEvent);
  }
}
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:20,代码来源:Mouse.java

示例2: mousePressed

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void mousePressed(MouseEvent e){
    	if(!SwingUtilities.isRightMouseButton(e)){
    		mouseDownCompCoords = e.getPoint();
    		rightMouseButtonPressed = true;
    	}
    	if(SwingUtilities.isRightMouseButton(e)){
    		if(timestampLow == 0){
    			timestampLow = (int) new Date().getTime();
    		}
    		else if(timestampHigh == 0){
    			timestampHigh = (int) new Date().getTime();
    		}
    		else{
    			timestampLow = timestampHigh;
    			timestampHigh = (int) new Date().getTime();
    		}
    		
if(timestampHigh - timestampLow < 350){
	ladderRestExpHour = true;
}
    	}
    }
 
开发者ID:jkjoschua,项目名称:poe-ladder-tracker-java,代码行数:23,代码来源:GUILadderTracker.java

示例3: mousePressed

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent event) {
    JTree tree = (JTree) event.getSource();
    int x = event.getX();
    int y = event.getY();

    int row = tree.getRowForLocation(x, y);
    TreePath path = tree.getPathForRow(row);

    // if path exists and mouse is clicked exactly once
    if (path == null) {
        return;
    }
    CheckNode node = (CheckNode) path.getLastPathComponent();

    if ( !SwingUtilities.isRightMouseButton(event)) {
        return;
    }
    Object o = node.getUserObject();

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:CheckNodeListener.java

示例4: mouseClickedOnItem

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
private void mouseClickedOnItem(MouseEvent e) {
    if (SwingUtilities.isRightMouseButton(e)) {
        e.consume();
        if (isSelected()) {
            Iterator<Category> iterator = evalCats.iterator();
            while (iterator.hasNext()) {
                Category c = iterator.next();
                if (!CommandEvaluator.RECENT.equals(c.getName())) {
                    iterator.remove();
                }
            }
            evalCats.add(category);
        } else {
            evalCats.addAll(
                    ProviderModel.getInstance().getCategories());
            evalCats.remove(category);
        }
        updateCheckBoxes(CategoryCheckBoxMenuItem.this, evalCats);
        updateCats(evalCats);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:AbstractQuickSearchComboBar.java

示例5: mouseClicked

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@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);
            }
        }
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:25,代码来源:TableCheckBoxColumn.java

示例6: mouseReleased

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mouseReleased(MouseEvent me) {
	super.mouseReleased(me);
	
	if (SwingUtilities.isRightMouseButton(me)) {
		if (this.movePanelWithRightAction==true) {
			this.movePanelWithRightAction = false;
			this.getVisViewer().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		}
	} else if (SwingUtilities.isLeftMouseButton(me)) {
		if (this.moveNodeWithLeftAction==true) {
			this.moveNodeWithLeftAction = false;	
			this.setNodesMoved2EndPosition();
			this.createUndoableMoveAction();
			this.nodesMoved.removeAllElements();
		} 
	}

}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:20,代码来源:GraphEnvironmentMousePlugin.java

示例7: mouseClicked

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
 * Call when the mouse has been clicked in the {@link ProcessRendererView}.
 *
 * @param e
 */
public void mouseClicked(final MouseEvent e) {
	if (SwingUtilities.isLeftMouseButton(e)) {
		if (e.getClickCount() == 2) {
			if (model.getHoveringOperator() != null) {
				if (model.getHoveringOperator() instanceof OperatorChain) {
					model.setDisplayedChain((OperatorChain) model.getHoveringOperator());
					model.fireDisplayedChainChanged();
					RapidMinerGUI.getMainFrame().addViewSwitchToUndo();
				}
				e.consume();
			}
		}
	} else if (SwingUtilities.isRightMouseButton(e)) {
		if (model.getConnectingPortSource() != null) {
			cancelConnectionDragging();
			connectionDraggingCanceled = true;
			e.consume();
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:26,代码来源:ProcessRendererMouseHandler.java

示例8: rightClick

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void rightClick(JTable jtable, java.awt.event.MouseEvent evt ){
    try {
        impostaMenu();
    } catch (SQLException ex) {
        Logger.getLogger(GuiPrincipale.class.getName()).log(Level.SEVERE, null, ex);
    }
    if(SwingUtilities.isRightMouseButton(evt)){
        
      int[] coordinate = coordinateMouse(jtable);
      
       jMenuPrincipale.show(this, coordinate[0]+evt.getX(), coordinate[1]+evt.getY());
    }
    try{
        int i = jtable.getSelectedRow();        
        id = Integer.parseInt(jtable.getValueAt(i, 2).toString());
        nomePrenotazione = (String) jtable.getValueAt(i, 0);
    }catch(ArrayIndexOutOfBoundsException s){}
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-N,代码行数:19,代码来源:GuiPrincipale.java

示例9: mousePressed

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
public void mousePressed(MouseEvent e) {
	if (SwingUtilities.isRightMouseButton(e)) {
		try {
			Robot robot = new java.awt.Robot();
			robot.mousePress(InputEvent.BUTTON1_MASK);
			robot.mouseRelease(InputEvent.BUTTON1_MASK);
		} catch (AWTException ex) {
			System.out.println(ex);
		}
	}
	maybeShowPopup(e);
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:13,代码来源:XMLJTreeDialog.java

示例10: mousePressed

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent event) {
    JTree tree = (JTree) event.getSource();
    int x = event.getX();
    int y = event.getY();

    int row = tree.getRowForLocation(x, y);
    TreePath path = tree.getPathForRow(row);

    // if path exists and mouse is clicked exactly once
    if (path == null) {
        return;
    }
    CheckNode node = (CheckNode) path.getLastPathComponent();

    if ( !SwingUtilities.isRightMouseButton(event)) {
        return;
    }
    Object o = node.getUserObject();

    if ( !(o instanceof TreeElement)) {
        return;
    }
    o = ((TreeElement) o).getUserObject();

    if (o instanceof RefactoringElement) {
        showPopup(((RefactoringElement) o).getLookup().lookupAll(Action.class), tree, x, y);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:CheckNodeListener.java

示例11: mousePressedOrClicked

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
 * Acts on the mouse pressed and mouse clicked action.
 * @param me the {@link MouseEvent}
 */
private void mousePressedOrClicked(MouseEvent me) {
	
	// --- Left click ---------------------------------
	if(SwingUtilities.isLeftMouseButton(me) || SwingUtilities.isRightMouseButton(me)){

		// --- Check if an object was selected --------
		Object pickedObject = null;
		Point point = me.getPoint();
		GraphElementAccessor<GraphNode, GraphEdge> ps = this.getVisViewer().getPickSupport();
		GraphNode pickedNode = ps.getVertex(this.getVisViewer().getGraphLayout(), point.getX(), point.getY());
		if(pickedNode != null) {  
			pickedObject = pickedNode;
		} else {
			GraphEdge pickedEdge = ps.getEdge(this.getVisViewer().getGraphLayout(), point.getX(), point.getY());
			if(pickedEdge != null) { 
				pickedObject = pickedEdge;
			}
		}

		// --- Only when node or edge is clicked -----------
		if(pickedObject != null) {
			if (me.getClickCount()==2){
				// --- Double click ---------
				this.basicGraphGUI.handleObjectDoubleClick(pickedObject);
			} else {
				if(me.isShiftDown()==false) {
					// --- Left click -----------
					this.basicGraphGUI.handleObjectLeftClick(pickedObject);
				}	
			} 
		}
	}
	
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:39,代码来源:GraphEnvironmentMousePlugin.java

示例12: mouseClicked

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent ev) {
	if (SwingUtilities.isRightMouseButton(ev)) {
		final int row = last_mouse_point.y / table.get_gate_table_row_height(),
				col = last_mouse_point.x / table.get_gate_table_col_width();
		
		for (int first_row = row; first_row >= 0; first_row--) {
			final Gate current = table.get_table().get_element(first_row, col);
			if (current != null && row - first_row + 1 <= current.get_ports_number()) {
				table.get_table().remove_element(first_row, col);
					
				if (table.get_table().get_col_count() > 1 &&
						col == table.get_table().get_col_count() - 2 &&
						table.get_table().is_col_empty(col)) {
						
					// Delete unnecessary empty columns
					for (int current_col = col; current_col >= 0; current_col--)
						if (table.get_table().is_col_empty(current_col))
							table.get_table().remove_last_col();
						else
							break;
						
					table.update_size();
				}	
					
				table.repaint();
				break;
			}
		}
		
		table.repaint();
	}
}
 
开发者ID:QwertygidQ,项目名称:DeutschSim,代码行数:34,代码来源:GateTable.java

示例13: mousePressed

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
    if (SwingUtilities.isLeftMouseButton(e)) {
        setOffsetMarker(e);
        drag = false;
        click.x = e.getX();
        click.y = e.getY();
    } else if (SwingUtilities.isRightMouseButton(e) && rcDisArm) {
        hideCropper();
    }

}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:13,代码来源:Cropper.java

示例14: mousePressed

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
 * Overridden to also focus the text component on right mouse clicks.
 *
 * @param e The mouse event.
 */
@Override
public void mousePressed(MouseEvent e) {
	super.mousePressed(e);
	if (!e.isConsumed() && SwingUtilities.isRightMouseButton(e)) {
		JTextComponent c = getComponent();
		if (c!=null && c.isEnabled() && c.isRequestFocusEnabled()) {
			c.requestFocusInWindow();
		}
	}
}
 
开发者ID:Thecarisma,项目名称:powertext,代码行数:16,代码来源:ConfigurableCaret.java

示例15: isToggleEvent

import javax.swing.SwingUtilities; //导入方法依赖的package包/类
/**
 * 
 * @param event
 * @return Returns true if the given event should toggle selected cells.
 */
public boolean isToggleEvent(MouseEvent event)
{
	// NOTE: IsMetaDown always returns true for right-clicks on the Mac, so
	// toggle selection for left mouse buttons requires CMD key to be pressed,
	// but toggle for right mouse buttons requires CTRL to be pressed.
	return (event != null) ? ((mxUtils.IS_MAC) ? ((SwingUtilities
			.isLeftMouseButton(event) && event.isMetaDown()) || (SwingUtilities
			.isRightMouseButton(event) && event.isControlDown()))
			: event.isControlDown())
			: false;
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:17,代码来源:mxGraphComponent.java


注:本文中的javax.swing.SwingUtilities.isRightMouseButton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。