这是一种方法:
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.scene.input.*;
var r = Rectangle {
x: 50, y: 50
width: 120, height: 120
fill: Color.RED
onMouseClicked: function(e:MouseEvent):Void {
if (e.button == MouseButton.SECONDARY) {
println("Right button clicked");
}
}
}
Stage {
title : "ClickTest"
scene: Scene {
width: 200
height: 200
content: [ r ]
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)