當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。