本文整理汇总了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);
}
示例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);
}
示例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());
}
示例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);
}
示例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));
}
示例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);
}
示例7: mouseClicked
import com.jogamp.newt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON3)
ClipBoardCopier.getSingletonInstance().setString(getText());
}
示例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;
}
示例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));
}