private void gotoRightClick(){
textArea.setOnMouseClicked(new EventHandler<MouseEvent>(){
@Override
public void handle(MouseEvent event) {
if(event.isSecondaryButtonDown())
{
System.out.println("right click pressed in text area");
}
}
});
tableView.setOnMouseClicked(new EventHandler<MouseEvent>(){
@Override
public void handle(MouseEvent e) {
if(e.isSecondaryButtonDown())
{
System.out.println("right click pressed in table view");
}
}
});
}
没有一个事件被发现可以帮助我吗? 谢谢你的进步
答案 0 :(得分:0)
试试这个:
this.setOnMouseClicked(new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent event) {
if (event.getButton().equals(MouseButton.SECONDARY)) {
//do something
}
}
});