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


Java MouseEvent.BUTTON3属性代码示例

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


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

示例1: mouseReleased

@Override
public void mouseReleased(MouseEvent e) {
	int button = e.getButton();
	// If not left-click, enforce selection at the given location
	if (button != MouseEvent.BUTTON1) {
		int index = list.locationToIndex(e.getPoint());
		list.setSelectedIndex(index);
	}
	Object value = list.getSelectedValue();
	// Middle-click to open editor
	// Right-click to open context menu
	if (value != null && button == MouseEvent.BUTTON2) {
		// TODO: Allow users to choose custom middle-click actions
		if (value instanceof FieldNode) {
			display.openDefinition((FieldNode) value);
		} else if (value instanceof MethodNode) {
			display.openOpcodes((MethodNode) value);
		}
	} else if (button == MouseEvent.BUTTON3) {
		createContextMenu(value, e.getX(), e.getY(), isMethodList(list));
	}
}
 
开发者ID:Col-E,项目名称:Recaf,代码行数:22,代码来源:MemberNodeClickListener.java

示例2: getMouseClickedListener

private MouseListener getMouseClickedListener(final SVGContextMenu menu) {

    return new MouseAdapter() {

      @Override
      public void mouseClicked(MouseEvent e) {

        Point p = new Point(e.getPoint());
        SwingUtilities.convertPointToScreen(p, canvas);
        if (menu.isVisible()) {
          if (e.getButton() == MouseEvent.BUTTON3) {
            menu.setLocation(p);
            return;
          }
          else {
            menu.setVisible(false);
          }
        }
        if (e.getButton() == MouseEvent.BUTTON3) {
          menu.setLocation(p);
          menu.setVisible(true);
        }
      }
    };
  }
 
开发者ID:etomica,项目名称:etomica,代码行数:25,代码来源:GraphMap.java

示例3: mouseClicked

@Override
public void mouseClicked(MouseEvent e) {
	if (e.getButton() == MouseEvent.BUTTON1) {
		if (e.getClickCount() > 1) {
			String id = plotter.getIdForPos(e.getX(), e.getY());
			if (id != null) {
				ObjectVisualizer visualizer = ObjectVisualizerService.getVisualizerForObject(dataTable);
				visualizer.startVisualization(id);
			}
		}
	} else if (e.getButton() == MouseEvent.BUTTON3) {
		plotter.setDrawRange(-1, -1, -1, -1);
		pressStart = null;
		plotter.setDragBounds(-1, -1, -1, -1);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:16,代码来源:PlotterMouseHandler.java

示例4: mouseReleased

@Override
public void mouseReleased(MouseEvent e) {
	int button = e.getButton();
	if (list.getSelectedIndices().length <= 1) {
		// If not left-click, enforce selection at the given location
		if (button != MouseEvent.BUTTON1) {
			int index = list.locationToIndex(e.getPoint());
			list.setSelectedIndex(index);
		}
	}
	Object value = list.getSelectedValue();
	if (value == null) {
		return;
	}
	if (button == MouseEvent.BUTTON3) {
		createContextMenu((AbstractInsnNode) value, e.getX(), e.getY());
	} else if (button == MouseEvent.BUTTON2) {
		createEdit((AbstractInsnNode) value, e.getX(), e.getY());
	}
}
 
开发者ID:Col-E,项目名称:Recaf,代码行数:20,代码来源:OpcodeMouseListener.java

示例5: mousePressed

public final void mousePressed(MouseEvent e)
{
	int internalButton = 0;
	switch (e.getButton())
	{
		case MouseEvent.BUTTON1:
			internalButton = 0;
			break;
		case MouseEvent.BUTTON3:
			internalButton = 1;
			break;
		case MouseEvent.BUTTON2:
			internalButton = 2;
			break;
	}

	game.gameQueue.add(new MousePressEvent(SparkEvents.E_MOUSEDOWN,
			internalButton, e.getX(), e.getY()));
}
 
开发者ID:TheRemote,项目名称:Spark,代码行数:19,代码来源:Java2DFrame.java

示例6: mouseClicked

@Override
public void mouseClicked(MouseEvent e) {
	
	FenetreGestionDeProjet fenetre = FenetreGestionDeProjet.getInstance();
	
	// TODO Auto-generated method stub
	if (e.getButton() == MouseEvent.BUTTON3) {
		//System.out.println("modification et suppression");
		JMenu contextMenu = new JMenu();
		JMenuItem modifie = new JMenuItem("Modifier");
		JMenuItem supprime = new JMenuItem("Supprimer");
		contextMenu.add(modifie);
		contextMenu.add(supprime);
		contextMenu.setMenuLocation(e.getX(),e.getY());
		
		fenetre.add(contextMenu);

		contextMenu.setEnabled(true);
		contextMenu.setVisible(true);
		
		contextMenu.setPopupMenuVisible(true);
	}
}
 
开发者ID:TeamLDCCIIT,项目名称:Java_GestionProjet,代码行数:23,代码来源:ActionClickDroit.java

示例7: mousePressed

@Override
public State mousePressed (Widget widget, WidgetMouseEvent event) {
    Point localLocation = event.getPoint();
    if ((event.getButton() & (MouseEvent.BUTTON1  | MouseEvent.BUTTON2  | MouseEvent.BUTTON3)) != 0) {
        if (process (widget, localLocation, event.getModifiersEx ()))
            return State.CHAIN_ONLY;
    }
    return State.REJECTED;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ContiguousSelectAction.java

示例8: mousePressed

public State mousePressed (Widget widget, WidgetMouseEvent event) {
    if (isLocked()) {
        return State.createLocked(widget, this);
    }
    
    Point localLocation = event.getPoint();
    
    if (event.getButton() == MouseEvent.BUTTON1 || event.getButton() == MouseEvent.BUTTON2) {
        invertSelection = (event.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) != 0;
        
        if (provider.isSelectionAllowed(widget, localLocation, invertSelection)) {
            aiming = provider.isAimingAllowed(widget, localLocation, invertSelection);
            if (aiming) {
                updateState(widget, localLocation);
                return State.createLocked(widget, this);
            } else {
                provider.select(widget, localLocation, invertSelection);
                return State.CHAIN_ONLY;
            }
        }
    } else if (trapRightClick && event.getButton() == MouseEvent.BUTTON3) {
        provider.select(widget, localLocation, false);
        return State.CHAIN_ONLY;
    }
    
    return State.REJECTED;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:SelectAction.java

示例9: mouseClicked

@Override
public void mouseClicked(MouseEvent e) {
	if(e.getButton() == MouseEvent.BUTTON1) {
		colar(e.getX(), e.getY());
		ImageIcon icone = new ImageIcon(img);
		background.setIcon(icone);
	}else if(e.getButton() == MouseEvent.BUTTON3) {
		copiar(e.getX(), e.getY());
	}
}
 
开发者ID:mundodehads,项目名称:cc-unespar,代码行数:10,代码来源:Carimbo.java

示例10: mouseClicked

public void mouseClicked(MouseEvent ev) {
	if (ev.getButton() == MouseEvent.BUTTON3) {
		rightClick(ev);
	} else {

	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:7,代码来源:DistributionDensityGraph.java

示例11: mousePressed

@Override
public void mousePressed(MouseEvent evt) {
    TreePath path = getPathForLocation(evt.getX(), evt.getY());
    if (path != null) {
        if (evt.getButton() == MouseEvent.BUTTON3 && !isRowSelected(getRowForPath(path))) {
            setSelectionPath(path);
        }
        DisplayKind toDisplay = null;
        Object lastComponent = path.getLastPathComponent();
        if (lastComponent instanceof RuleTreeNode) {
            toDisplay = DisplayKind.RULE;
        } else if (lastComponent instanceof RecipeTreeNode) {
            toDisplay = DisplayKind.CONTROL;
        } else if (lastComponent instanceof MatchTreeNode
            && getSimulatorModel().getDisplay() != DisplayKind.LTS) {
            toDisplay = DisplayKind.STATE;
        }
        if (evt.getClickCount() == 1 && toDisplay != null) {
            getSimulatorModel().setDisplay(toDisplay);
        } else if (evt.getClickCount() == 2 && toDisplay != null) {
            if (toDisplay.hasResource()) {
                getActions().getEditAction(toDisplay.getResource())
                    .execute();
            }
        }
    }
    maybeShowPopup(evt);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:28,代码来源:RuleTree.java

示例12: mousePressed

/**
 * {@inheritDoc}
 */
public void mousePressed(MouseEvent e) {
    if (!e.getComponent().isEnabled()) return;

    final Tile tile = canvas.convertToMapTile(e.getX(), e.getY());
    final int me = (e.isPopupTrigger()) ? MouseEvent.BUTTON3
        : e.getButton();
    switch (me) {
    case MouseEvent.BUTTON1:
        // Record initial click point for purposes of dragging,
        // @see CanvasMouseMotionListener#mouseDragged.
        canvas.setDragPoint(e.getX(), e.getY());

        // New click sequence? Remember position to use when timer expires
        if (!doubleClickTimer.isRunning()) {
            centerX = e.getX();
            centerY = e.getY();
        }
        doubleClickTimer.start();
        canvas.requestFocus();
        break;
    case MouseEvent.BUTTON2:
        immediateGoto(tile);
        break;
    case MouseEvent.BUTTON3:
        immediatePopup(tile, e.getX(), e.getY());
        break;
    default:
        break;
    }
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:33,代码来源:CanvasMouseListener.java

示例13: mouseClicked

public void mouseClicked(MouseEvent ev) {
	if (ev.getButton() == MouseEvent.BUTTON3) {
		super.rightClick(ev);
		return;
	}
	DPoint test = this.adjustMousePoint(ev.getX(), ev.getY());
	for (int i = 0; i < data.getStationNames().length; i++) {
		if (stationLabels[i] != null && stationLabels[i].contains(test)) {
			showStation[i] = !showStation[i];
			repaint();
		}
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:13,代码来源:PerformanceIndices2DGraph.java

示例14: mouseClicked

@Override
public void mouseClicked(MouseEvent e) {
    if (e.getButton() == MouseEvent.BUTTON3) {
        jtc.requestFocus();
        showMenu(e.getX(), e.getY());
    }
}
 
开发者ID:ajtdnyy,项目名称:PackagePlugin,代码行数:7,代码来源:MouseListener.java

示例15: mouseClicked

public void mouseClicked(MouseEvent e) {
	Point2D p = e.getPoint();

	if (p == null)
		return;

	p = renderer.screenToWorld(p);

	if (e.getButton() == MouseEvent.BUTTON1 && mouseInMode(Mode.EDITING)) {
		// create a node
		isCreatingVertex = true;
		Vertex vertex = new Vertex();
		vertex.setPosition(p);
		UndoableAction action = new CreateVertexUndoableAction(
				networkPanel.getNetwork(), vertex);
		action.execute();
		UndoableControl.getController().actionExecuted(action);

	} else if (e.getButton() == MouseEvent.BUTTON3) {
		Vertex v = pickSupport.pickVertex(p);

		if (v != null) {
			new EditVertexMenu(v, networkPanel.getNetwork(), e).show();

		} else {
			Edge edge = pickSupport.pickEdge(p);

			if (edge != null) {
				new EditEdgeMenu(edge, networkPanel.getNetwork(), e).show();
			}
		}
	}
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:33,代码来源:GraphMouseImpl.java


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