jnodemouseevent.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 114 行
JAVA
114 行
package org.jnode.wt.events;
/**
* @author vali
*/
public class JNodeMouseEvent extends JNodeInputEvent {
/** Which button has changed (if any) */
private int button;
/** X location */
private int x;
/** Y location */
private int y;
// ------------------------------------------
// Buttons
public static final int NOBUTTON = 0;
public static final int BUTTON1 = 1;
public static final int BUTTON2 = 2;
public static final int BUTTON3 = 3;
// ------------------------------------------
// event IDs
/** This is the first id in the range of event ids used by this class. */
public static final int MOUSE_FIRST = 500;
/** This is the last id in the range of event ids used by this class. */
public static final int MOUSE_LAST = 507;
/** This event id indicates that the mouse was clicked. */
public static final int MOUSE_CLICKED = 500;
/** This event id indicates that the mouse was pressed. */
public static final int MOUSE_PRESSED = 501;
/** This event id indicates that the mouse was released. */
public static final int MOUSE_RELEASED = 502;
/** This event id indicates that the mouse was moved. */
public static final int MOUSE_MOVED = 503;
/** This event id indicates that the mouse entered a component. */
public static final int MOUSE_ENTERED = 504;
/** This event id indicates that the mouse exited a component. */
public static final int MOUSE_EXITED = 505;
/** This event id indicates that the mouse was dragged over a component. */
public static final int MOUSE_DRAGGED = 506;
/** This event id indicates that the mouse wheel was rotated. */
public static final int MOUSE_WHEEL = 507;
/**
* @param source
* @param id
*/
public JNodeMouseEvent(Object source, int id, int x, int y) {
super(source, id);
this.x = x;
this.y = y;
this.button = BUTTON2;
}
/**
* @param source
* @param id
*/
public JNodeMouseEvent(Object source, int id, int x, int y, int button) {
super(source, id);
this.x = x;
this.y = y;
this.button = button;
}
/**
* Gets the button that has changed, if any.
* @return Returns the button.
*/
public final int getButton() {
return this.button;
}
/**
* @return Returns the x.
*/
public int getX() {
return this.x;
}
/**
* @return Returns the y.
*/
public int getY() {
return this.y;
}
public void translate(int x, int y) {
this.x -= x;
this.y -= y;
}
public void translatePoint(int x, int y) {
// this.x += x;
// this.y += y;
translate(x, y);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?