0
当我使用mouseListener时,我为鼠标中键敲响它不能正常响应我不知道为什么,但它看起来像我需要滚动,而要求发生事件发生 我的一些代码的一部分,如果有帮助java上的鼠标中键无法正常工作
public void mouseClicked(MouseEvent e) {
if(new Rectangle(0,0,1274,30).contains(Screen.mse)){
TopMenu.click();
}else if(new Rectangle(0,31,1100,549).contains(Screen.mse)){
Map.cliked(e.getButton(),0);
System.out.println("mouse:"+e.getButton());
}else if(new Rectangle(1100,30,174,550).contains(Screen.mse)){
//cliked ModeMenu
}else if(new Rectangle(0,580,1100,164).contains(Screen.mse)){
//cliked ToolsMenu
}else{
//cliked mode change
}
switch(e.getModifiers()) {
case InputEvent.BUTTON1_MASK: {
System.out.println("That's the LEFT button");
break;
}
case InputEvent.BUTTON2_MASK: {
System.out.println("That's the MIDDLE button");
break;
}
case InputEvent.BUTTON3_MASK: {
System.out.println("That's the RIGHT button");
break;
}
}
}
看一看[哪个鼠标按钮(当然与你原来的switch语句上面写的其他代码的)是中间的一个?](http://stackoverflow.com/questions/8972267/which-mouse-button-is-the-middle-one)。 – 2013-03-26 20:29:56