本文整理汇总了Java中javafx.scene.input.MouseEvent.isSecondaryButtonDown方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.isSecondaryButtonDown方法的具体用法?Java MouseEvent.isSecondaryButtonDown怎么用?Java MouseEvent.isSecondaryButtonDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.input.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.isSecondaryButtonDown方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handlePolygonClickAction
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@FXML
private void handlePolygonClickAction(MouseEvent event) {
if (polygonButton.isSelected()) {
if (event.isSecondaryButtonDown()) {
double[] xArray = new double[xValues.size()];
double[] yArray = new double[yValues.size()];
for (int i = 0; i < xArray.length; i++) {
xArray[i] = xValues.get(i);
yArray[i] = yValues.get(i);
}
gc.fillPolygon(xArray, yArray, xArray.length);
} else {
xValues.add(event.getX());
yValues.add(event.getY());
if (xValues.size() > 1) {
gc.strokeLine(xValues.get(xValues.size() - 2), yValues.get(yValues.size() - 2),
xValues.get(xValues.size() - 1), yValues.get(yValues.size() - 1));
}
}
}
}
示例2: mouseEventGetModifiersExText
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
public static String mouseEventGetModifiersExText(MouseEvent event) {
StringBuffer sb = new StringBuffer();
if (event.isControlDown()) {
sb.append("Ctrl+");
}
if (event.isMetaDown()) {
sb.append("Meta+");
}
if (event.isAltDown()) {
sb.append("Alt+");
}
if (event.isShiftDown()) {
sb.append("Shift+");
}
if (event.isPrimaryButtonDown()) {
sb.append("Button1+");
}
if (event.isMiddleButtonDown()) {
sb.append("Button2+");
}
if (event.isSecondaryButtonDown()) {
sb.append("Button3+");
}
String text = sb.toString();
if (text.equals("")) {
return text;
}
return text.substring(0, text.length() - 1);
}
示例3: mouseEventGetModifiersExText
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
public static String mouseEventGetModifiersExText(MouseEvent event) {
StringBuffer sb = new StringBuffer();
if (event.isControlDown()) {
sb.append("Ctrl+");
}
if (event.isMetaDown()) {
sb.append("Meta+");
}
if (event.isAltDown()) {
sb.append("Alt+");
}
if (event.isShiftDown()) {
sb.append("Shift+");
}
if (event.isPrimaryButtonDown()) {
sb.append("Button1+");
}
if (event.isMiddleButtonDown()) {
sb.append("Button2+");
}
if (event.isSecondaryButtonDown()) {
sb.append("Button3+");
}
String text = sb.toString();
if (text.equals("")) {
return text;
}
return text.substring(0, text.length() - 1);
}
示例4: handle
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
/**
* Sets the current position of the mouse and the current position on the canvas
* @param event - event
*/
public void handle(MouseEvent event) {
// right mouse button => panning
if (!event.isSecondaryButtonDown()) {
return;
}
sceneDragContext.mouseAnchorX = event.getSceneX();
sceneDragContext.mouseAnchorY = event.getSceneY();
sceneDragContext.translateAnchorX = canvas.getTranslateX();
sceneDragContext.translateAnchorY = canvas.getTranslateY();
}