当我使用 mouseListener 并检查鼠标中键时,它没有正确反应我不知道为什么,但看起来我需要在单击时滚动以使事件发生在我的代码的某些部分(如果有帮助)
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;
}
}
}