當前位置: 首頁>>代碼示例>>Java>>正文


Java MouseEvent.isShiftDown方法代碼示例

本文整理匯總了Java中javafx.scene.input.MouseEvent.isShiftDown方法的典型用法代碼示例。如果您正苦於以下問題:Java MouseEvent.isShiftDown方法的具體用法?Java MouseEvent.isShiftDown怎麽用?Java MouseEvent.isShiftDown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.input.MouseEvent的用法示例。


在下文中一共展示了MouseEvent.isShiftDown方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: canvasClicked

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
@Override
public void canvasClicked(MouseEvent mouseEvent) {
	DrawCoords mousePosition = new DrawCoords(mouseEvent.getX(), mouseEvent.getY());
	CoordProjector projector = getProjector(boardCanvas);
	Coords boardPos = projector.nearestCoords(mousePosition);

	if ( !projector.isWithinBounds(mousePosition) )
		return;

	scorePane.enableButtons();
	if ( mouseEvent.getButton() == MouseButton.PRIMARY ) {
		if ( !mouseEvent.isShiftDown() )
			boardScorer.markGroupDead(boardPos);
		else
			boardScorer.unmarkGroupDead(boardPos);
	}
}
 
開發者ID:GoSuji,項目名稱:Suji,代碼行數:18,代碼來源:Scoring.java

示例2: 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();
}
 
開發者ID:lttng,項目名稱:lttng-scope,代碼行數:26,代碼來源:ExampleMouseDrag2.java

示例3: 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;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:21,代碼來源:WSRecorder.java

示例4: changeHiddenPower

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
public void changeHiddenPower(Event event) {
    if (event instanceof MouseEvent) {
        MouseEvent mouseEvent = (MouseEvent) event;
        MouseButton mouseButton = mouseEvent.getButton();
        if (mouseEvent.isShiftDown() || mouseButton.equals(MouseButton.SECONDARY)) {
            pokemon.setHiddenPower(hiddenPowerCalculator.updateToNext());
        } else if (mouseButton.equals(MouseButton.PRIMARY)) {
            pokemon.setHiddenPower(hiddenPowerCalculator.updateToPrevious());
        } else if (mouseButton.equals(MouseButton.MIDDLE)) {
            pokemon.setHiddenPower(hiddenPowerCalculator.setUnknown());
        }
    } else if (event instanceof ScrollEvent) {
        double delta = ((ScrollEvent) event).getDeltaY();
        if (delta > 0) {
            pokemon.setHiddenPower(hiddenPowerCalculator.updateToNext());
        } else if (delta < 0) {
            pokemon.setHiddenPower(hiddenPowerCalculator.updateToPrevious());
        }
    }
}
 
開發者ID:wartab,項目名稱:gen7-iv-calculator,代碼行數:21,代碼來源:OutputPresenter.java

示例5: setStat

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
public void setStat(MouseEvent event) {
    Button button = (Button) event.getSource();
    if (button.isDisabled()) {
        return;
    }
    int value = Integer.valueOf(button.getText());

    int min = pokemon.getMinIndividualValues().get(stat).get();
    int max = pokemon.getMaxIndividualValues().get(stat).get();
    history.addStat(stat, min, max);

    if (!event.isShiftDown()) {
        pokemon.setKnownStat(stat, value);
    } else {
        pokemon.setKnownIv(stat, statButtons.indexOf(button));
    }
}
 
開發者ID:wartab,項目名稱:gen7-iv-calculator,代碼行數:18,代碼來源:StatSelectorPresenter.java

示例6: 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);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:31,代碼來源:OSFXUtils.java

示例7: 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();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:33,代碼來源:EventQueueDeviceTest.java

示例8: 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);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:30,代碼來源:JavaFxRecorderHook.java

示例9: 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;
}
 
開發者ID:jfree,項目名稱:jfreechart-fx,代碼行數:18,代碼來源:AbstractMouseHandlerFX.java

示例10: edgePressed

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
@FXML
public void edgePressed(final MouseEvent event) {
    if (!event.isShiftDown()) {
        event.consume();

        if (event.isShortcutDown()) {
            SelectHelper.addToSelection(this);
        } else {
            SelectHelper.select(this);
        }
    }
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:13,代碼來源:EdgeController.java

示例11: isMultiSelect

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
private boolean isMultiSelect(MouseEvent evt) {
    return (evt.isShiftDown() || evt.isShortcutDown()) && getSelectionMode().equals(MULTIPLE);
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:4,代碼來源:DateControl.java

示例12: 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;
    }
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:58,代碼來源:YearMonthViewSkin.java


注:本文中的javafx.scene.input.MouseEvent.isShiftDown方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。