如题,应该怎样加事件进行判断?在Display上加过滤器和监听都不好使
------解决方案--------------------
不知道啊,帮你顶吧
------解决方案--------------------
从网上查了下,自己也试了下没有得到想要的结果。现在我给楼主出一个歪主意供LZ参考,去锁定标题的坐标然后根据鼠标移动的坐标去做判断,获得鼠标移动坐标的方法如下:
new Listener(){
public void handleEvent(Event event) {
CellEditor[] cellEditor=new CellEditor[tableViewer.getTable ().getColumnCount()];
TableItem [] tableValues=table.getItems();
Point pt = new Point(event.x, event.y);
System.out.println("获得鼠标停留时的坐标 ,x轴坐标:"+pt.x+";y轴坐标:"+pt.y)
}
捕获鼠标点击事件:
- Java code
package test.actions;import java.awt.Event;import java.awt.event.MouseEvent;import javax.swing.event.MouseInputListener;public class mouseDown implements MouseInputListener { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub } public void mouseClicked(MouseEvent e) { if(e.getModifiers()!=Event.META_MASK){ System.out.println("11111111111"); } } public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub } public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } public void mouseDragged(MouseEvent e) { // TODO Auto-generated method stub } public void mouseMoved(MouseEvent e) { // TODO Auto-generated method stub }}