java.awt.event
Class MouseEvent
java.lang.Object
|
+-java.util.EventObject
|
+-java.awt.AWTEvent
|
+-java.awt.event.ComponentEvent
|
+-java.awt.event.InputEvent
|
+-java.awt.event.MouseEventgetPoint
public Point getPoint()Returns the x,y position of the event relative to the source component.
Returns:a Point object containing the x and y coordinates
relative to the source component
Class MouseEvent
java.lang.Object
|
+-java.util.EventObject
|
+-java.awt.AWTEvent
|
+-java.awt.event.ComponentEvent
|
+-java.awt.event.InputEvent
|
+-java.awt.event.MouseEventgetPoint
public Point getPoint()Returns the x,y position of the event relative to the source component.
Returns:a Point object containing the x and y coordinates
relative to the source component
解决方案 »
- 怎样在JTextArea中指定光标处插入字符串?
- java工程打包后,找不到依赖的jar包。求助如何设置manifest.mf文件
- 網頁讀JAVA程式
- 高分求救 java编译问题:package javax.xml.namespace does not exist
- 大家看看怎么做啊?谢谢
- 数据库编程
- J2EE与J2SE有哪些区别吗
- 请问有谁知道一款叫着mocha的java反编译器?
- 为什么代码规范要求在最后一行有EOL?
- jdk String private final char value[] 是怎么初始化的
- 高手招标(可以付款3000元人民币)
- ★☆★☆★☆★☆★☆★☆★☆★☆★☆JAVA版年度调查2★☆★☆★☆★☆★☆★☆★☆★☆★☆
如果使用你说的方法是无法实现这个要求的.
if (e instanceof FocusEvent) {
processFocusEvent((FocusEvent)e); } else if (e instanceof MouseEvent) {
switch(e.getID()) {
case MouseEvent.MOUSE_PRESSED:
case MouseEvent.MOUSE_RELEASED:
case MouseEvent.MOUSE_CLICKED:
case MouseEvent.MOUSE_ENTERED:
case MouseEvent.MOUSE_EXITED:
processMouseEvent((MouseEvent)e);
break;
case MouseEvent.MOUSE_MOVED:
case MouseEvent.MOUSE_DRAGGED:
processMouseMotionEvent((MouseEvent)e);
break;
} } else if (e instanceof KeyEvent) {
processKeyEvent((KeyEvent)e); } else if (e instanceof ComponentEvent) {
processComponentEvent((ComponentEvent)e);
} else if (e instanceof InputMethodEvent) {
processInputMethodEvent((InputMethodEvent)e);
} else if (e instanceof HierarchyEvent) {
switch (e.getID()) {
case HierarchyEvent.HIERARCHY_CHANGED:
processHierarchyEvent((HierarchyEvent)e);
break;
case HierarchyEvent.ANCESTOR_MOVED:
case HierarchyEvent.ANCESTOR_RESIZED:
processHierarchyBoundsEvent((HierarchyEvent)e);
break;
}
}
}
{
X = evt.getX();
Y = evt.getY();
}