本文整理汇总了Java中javafx.scene.input.MouseEvent.isControlDown方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.isControlDown方法的具体用法?Java MouseEvent.isControlDown怎么用?Java MouseEvent.isControlDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.input.MouseEvent
的用法示例。
在下文中一共展示了MouseEvent.isControlDown方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handle
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@Override
public void handle(MouseEvent event) {
// don't do anything if the user is in the process of adding to the selection model
if( event.isControlDown() || event.isShiftDown()) {
return;
}
Node node = (Node) event.getSource();
dragContext.x = node.getTranslateX() - event.getSceneX();
dragContext.y = node.getTranslateY() - event.getSceneY();
// clear the model if the current node isn't in the selection => new selection
if( !selectionModel.contains(node)) {
selectionModel.clear();
selectionModel.add( node);
}
// flag that the mouse released handler should consume the event, so it won't bubble up to the pane which has a rubberband selection mouse released handler
enabled = true;
// prevent rubberband selection handler
event.consume();
}
示例2: buildModifiersText
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private String buildModifiersText(MouseEvent e) {
StringBuilder sb = new StringBuilder();
if (e.isAltDown()) {
sb.append("Alt+");
}
if (e.isControlDown()) {
sb.append("Ctrl+");
}
if (e.isMetaDown()) {
sb.append("Meta+");
}
if (e.isShiftDown()) {
sb.append("Shift+");
}
if (sb.length() > 0) {
sb.setLength(sb.length() - 1);
}
String mtext = sb.toString();
return mtext;
}
示例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: getModifiersExText
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
protected static String getModifiersExText(MouseEvent event) {
StringBuffer buf = new StringBuffer();
if (event.isMetaDown()) {
buf.append("Meta");
buf.append("+");
}
if (event.isControlDown()) {
buf.append("Ctrl");
buf.append("+");
}
if (event.isAltDown()) {
buf.append("Alt");
buf.append("+");
}
if (event.isShiftDown()) {
buf.append("Shift");
buf.append("+");
}
if (event.getButton() == MouseButton.PRIMARY) {
buf.append("Button1");
buf.append("+");
}
if (event.getButton() == MouseButton.MIDDLE) {
buf.append("Button2");
buf.append("+");
}
if (event.getButton() == MouseButton.SECONDARY) {
buf.append("Button3");
buf.append("+");
}
return buf.toString();
}
示例5: 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);
}
示例6: 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);
}
}
示例7: hasMatchingModifiers
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
/**
* Returns {@code true} if the specified mouse event has modifier
* keys that match this handler.
*
* @param e the mouse event ({@code null} not permitted).
*
* @return A boolean.
*/
@Override
public boolean hasMatchingModifiers(MouseEvent e) {
boolean b = true;
b = b && (this.altKey == e.isAltDown());
b = b && (this.ctrlKey == e.isControlDown());
b = b && (this.metaKey == e.isMetaDown());
b = b && (this.shiftKey == e.isShiftDown());
return b;
}
示例8: mouseClicked
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@Override protected void mouseClicked(MouseEvent me) {
if (me.isControlDown() || me.isAltDown() || me.isMetaDown() || onCheckBox((Node) me.getTarget()))
return;
recorder.recordClick2(this, me, true);
}
示例9: newTab
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@FXML void newTab(MouseEvent mouseEvent) {
if(mouseEvent.getClickCount() == 1 && mouseEvent.isControlDown() ) {
generateTab();
}
}
示例10: handleSingleClick
import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void handleSingleClick(MouseEvent evt, Node node, LocalDate date) {
if (!(evt.getButton() == MouseButton.PRIMARY)) {
return;
}
YearMonthView view = getSkinnable();
switch (view.getClickBehaviour()) {
case NONE:
break;
case SHOW_DETAILS:
Callback<DateDetailsParameter, Boolean> callback = view.getDateDetailsCallback();
DateDetailsParameter param = new DateDetailsParameter(evt, view, node, date, evt.getScreenX(), evt.getScreenY());
callback.call(param);
break;
case PERFORM_SELECTION:
boolean multiSelect = evt.isShiftDown() || evt.isShortcutDown();
if (!multiSelect || (view.getSelectionMode().equals(SINGLE)
&& !evt.isControlDown())) {
view.getSelectedDates().clear();
}
if (evt.isShiftDown()) {
if (lastSelectedDate != null) {
LocalDate st = lastSelectedDate;
LocalDate et = date;
if (date.isBefore(st)) {
st = date;
et = lastSelectedDate;
}
do {
view.getSelectedDates().add(st);
st = st.plusDays(1);
} while (!et.isBefore(st));
} else {
view.getSelectedDates().clear();
view.getSelectedDates().add(date);
}
} else {
if (view.getSelectedDates().contains(date)) {
view.getSelectedDates().remove(date);
} else {
view.getSelectedDates().add(date);
}
}
lastSelectedDate = date;
if (!date.getMonth().equals(view.getYearMonth().getMonth())) {
view.setDate(date);
}
break;
default:
break;
}
}