本文整理匯總了Java中javafx.scene.input.MouseEvent.isPrimaryButtonDown方法的典型用法代碼示例。如果您正苦於以下問題:Java MouseEvent.isPrimaryButtonDown方法的具體用法?Java MouseEvent.isPrimaryButtonDown怎麽用?Java MouseEvent.isPrimaryButtonDown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.input.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.isPrimaryButtonDown方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
示例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: mousePressed
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
protected void mousePressed(MouseEvent me) {
if (me.isPrimaryButtonDown() && me.getClickCount() == 1 && !me.isAltDown() && !me.isMetaDown() && !me.isControlDown()) {
mouseButton1Pressed(me);
} else {
recorder.recordClick2(this, me, true);
}
}
示例4: handle
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
public void handle(MouseEvent event) {
// left mouse button => dragging
if (!event.isPrimaryButtonDown())
return;
nodeDragContext.mouseAnchorX = event.getSceneX();
nodeDragContext.mouseAnchorY = event.getSceneY();
Node node = (Node) event.getSource();
System.out.format("%10f,%10f%n", node.getTranslateX(), node.getTranslateY());
nodeDragContext.translateAnchorX = node.getTranslateX();
nodeDragContext.translateAnchorY = node.getTranslateY();
}
示例5: consumeIfPrimary
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
private void consumeIfPrimary(MouseEvent event) {
if (event.isPrimaryButtonDown()) {
event.consume();
}
}