本文整理匯總了Java中javafx.scene.input.MouseEvent.isStillSincePress方法的典型用法代碼示例。如果您正苦於以下問題:Java MouseEvent.isStillSincePress方法的具體用法?Java MouseEvent.isStillSincePress怎麽用?Java MouseEvent.isStillSincePress使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.input.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.isStillSincePress方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: notifyClickEvent
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
/**
* Use this method to process a click event and send a special GUI event by the means of the message system.
* @param event MouseEvent. A click event
*/
void notifyClickEvent(MouseEvent event) {
if (!event.isStillSincePress()) {
return;
}
Map<String, Object> m = new HashMap<>();
m.put("screenX", event.getScreenX());
m.put("screenY", event.getScreenY());
m.put("nodeX", event.getScreenX() - sender.getLayoutX());
m.put("nodeY", event.getScreenY() - sender.getLayoutY());
m.put("nodeWidth", sender.getLayoutBounds().getWidth());
m.put("nodeHeight", sender.getLayoutBounds().getHeight());
StringBuilder eventMessage = new StringBuilder("gui-events:").append(senderName).append("-");
if (event.getButton() == MouseButton.PRIMARY) {
if (event.getClickCount() == 2) {
eventMessage.append("double");
} else {
eventMessage.append("left");
}
} else if (event.getButton() == MouseButton.SECONDARY) {
eventMessage.append("right");
} else if (event.getButton() == MouseButton.MIDDLE) {
eventMessage.append("middle");
} else {
return;
}
eventMessage.append("-click");
Main.getInstance().getPluginProxy().sendMessage(eventMessage.toString(), m);
}
示例2: onClicked
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
private void onClicked(NodeModel nodeModel, MouseEvent event) {
if (event.getButton().equals(MouseButton.PRIMARY)) {
if (event.isShortcutDown() && event.isStillSincePress() && lastElementSelectedAtShortcutAndPress) {
nodeModel.setSelected(false);
}
}
}
示例3: onBackgroundReleased
import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
private void onBackgroundReleased(MouseEvent event) {
if (event.getButton() == MouseButton.PRIMARY) {
root.setVisible(false);
dragActive = false;
if (!event.isStillSincePress()) {
selectInBounds(root.getBoundsInParent());
}
root.setWidth(0);
root.setHeight(0);
}
}