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


Java MouseEvent.getButton方法代码示例

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


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

示例1: mouseReleased

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseReleased(MouseEvent e) {
    // called when a mouse button is waiting for release and was released

    // set the mouse state to released for the button
    int code = e.getButton();
    MouseButton mb = this.buttons.get(code);
    // check if the mouse event is in the map
    if (mb == null) {
        // if not, then add it
        mb = new MouseButton(code);
        this.buttons.put(code, mb);
    }
    mb.setPressed(false);
    mb.setWasReleased(true);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:17,代码来源:Mouse.java

示例2: mouseDragged

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
    // called when a mouse button is waiting for release and the mouse is moving

    // set the mouse location
    this.moved = true;
    this.location = new Point(e.getX(), e.getY());
    // set the mouse button pressed flag
    int code = e.getButton();
    MouseButton mb = this.buttons.get(code);
    // check if the mouse event is in the map
    if (mb == null) {
        // if not, then add it
        mb = new MouseButton(code);
        this.buttons.put(code, mb);
    }
    mb.setPressed(true);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:19,代码来源:Mouse.java

示例3: mouseClicked

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
    int code = e.getButton();
    MouseButton mb = this.buttons.get(code);
    // check if the mouse event is in the map
    if (mb == null) {
        // if not, then add it
        mb = new MouseButton(code);
        this.buttons.put(code, mb);
    }
    // set the value directly (since this can be a single/double/triple etc click)
    mb.setValue(e.getClickCount());
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:14,代码来源:Mouse.java

示例4: mousePressed

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
    // called when a mouse button is pressed and is waiting for release

    // set the mouse state to pressed + held for the button
    int code = e.getButton();
    MouseButton mb = this.buttons.get(code);
    // check if the mouse event is in the map
    if (mb == null) {
        // if not, then add it
        mb = new MouseButton(code);
        this.buttons.put(code, mb);
    }
    mb.setPressed(true);
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:16,代码来源:Mouse.java

示例5: mousePressed

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
	_isDown[e.getButton()] = true;
	_startX = e.getX();
	_startY = e.getY();
	_lastX = e.getX();
	_lastY = e.getY();
	_listener.mouseButtonDown(_windowID, _lastX, _lastY, e.getButton(), true, modsFromEvent(e));
}
 
开发者ID:jaamsim,项目名称:jaamsim,代码行数:10,代码来源:MouseHandler.java

示例6: mouseDragged

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
	if (!_isDown[e.getButton()]) {
		return; // This should probably not happen, but just in case...
	}
	int deltaX = e.getX() - _lastX;
	int deltaY = e.getY() - _lastY;

	_lastX = e.getX();
	_lastY = e.getY();

	_window.setMouseX(_lastX);
	_window.setMouseY(_lastY);

	WindowInteractionListener.DragInfo dragInfo = new WindowInteractionListener.DragInfo();
	dragInfo.windowID = _windowID;
	dragInfo.x = _lastX;
	dragInfo.y = _lastY;
	dragInfo.dx = deltaX;
	dragInfo.dy = deltaY;
	dragInfo.startX = _startX;
	dragInfo.startY = _startY;
	dragInfo.button = e.getButton();
	dragInfo.modFlags = modsFromEvent(e);

	_listener.mouseDragged(dragInfo);
}
 
开发者ID:jaamsim,项目名称:jaamsim,代码行数:28,代码来源:MouseHandler.java

示例7: mouseClicked

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
    if (e.getButton() == MouseEvent.BUTTON3)
        ClipBoardCopier.getSingletonInstance().setString(getText());
}
 
开发者ID:Helioviewer-Project,项目名称:JHelioviewer-SWHV,代码行数:6,代码来源:PositionStatusPanel.java

示例8: notifyEyeRay

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public boolean notifyEyeRay(ClearGLVolumeRenderer pRenderer,
							MouseEvent pMouseEvent,
							EyeRay pEyeRay)
{
	if (!mMovable)
		return false;

	// System.out.println(pMouseEvent);

	final boolean lCorrectModifier = true; // pMouseEvent.isShiftDown();
	final boolean lCorrectMouseButton = pMouseEvent.getButton() == 1;
	final boolean lCorrectMouseEvent = (pMouseEvent.getEventType() == MouseEvent.EVENT_MOUSE_CLICKED || pMouseEvent.getEventType() == MouseEvent.EVENT_MOUSE_DRAGGED);

	if (!(lCorrectMouseButton && lCorrectMouseEvent && lCorrectModifier))
		return false;

	final float[] lX = new float[]
	{ x, y, z };

	final float[] lO2X = GLMatrix.clone(lX);
	GLMatrix.sub(lO2X, pEyeRay.org);

	final float lProjectionLength = GLMatrix.dot(	lO2X,
													pEyeRay.dir);
	final float[] lClosestPoint = GLMatrix.clone(pEyeRay.dir);
	GLMatrix.mult(lClosestPoint, lProjectionLength);
	GLMatrix.add(lClosestPoint, pEyeRay.org);

	final float mx = pMouseEvent.getX();
	final float my = pMouseEvent.getY();

	// System.out.format("MX=%g MY=%g \n", mx, my);

	final double lDistance = sqrt((mx - px) * (mx - px)
									+ (my - py)
									* (my - py));

	// final float[] lCP2X = GLMatrix.clone(lX);
	// GLMatrix.distance(lCP2X, lClosestPoint);
	// final float lDistanceToClosestPoint = GLMatrix.norm(lCP2X);

	/*System.out.println(pEyeRay);
	System.out.println(Arrays.toString(lClosestPoint));
	System.out.println("lDistanceToClosestPoint=" + lDistanceToClosestPoint);
	/**/

	if (lDistance < getDistanceThreshold())
	{
		x = clamp(lClosestPoint[0]);
		y = clamp(lClosestPoint[1]);
		z = clamp(lClosestPoint[2]);
		mHasChanged = true;
		return true;
	}

	return false;

}
 
开发者ID:ClearVolume,项目名称:ClearVolume,代码行数:60,代码来源:CursorOverlay.java

示例9: mouseReleased

import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseReleased(MouseEvent e) {
	_isDown[e.getButton()] = false;
	_listener.mouseButtonDown(_windowID, _lastX, _lastY, e.getButton(), false, modsFromEvent(e));
}
 
开发者ID:jaamsim,项目名称:jaamsim,代码行数:6,代码来源:MouseHandler.java


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