当前位置: 首页>>代码示例>>Java>>正文


Java MouseEvent.getTarget方法代码示例

本文整理汇总了Java中javafx.scene.input.MouseEvent.getTarget方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.getTarget方法的具体用法?Java MouseEvent.getTarget怎么用?Java MouseEvent.getTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.input.MouseEvent的用法示例。


在下文中一共展示了MouseEvent.getTarget方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: performSelection

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void performSelection(MouseEvent evt) {
    if ((evt.getButton().equals(PRIMARY) || evt.isPopupTrigger()) && evt.getClickCount() == 1) {

        Entry<?> entry;
        EntryViewBase<?> view = null;

        if (evt.getTarget() instanceof EntryViewBase) {
            view = (EntryViewBase<?>) evt.getTarget();
        }

        if (view == null) {
            return;
        }

        String disableFocusHandlingKey = "disable-focus-handling"; //$NON-NLS-1$

        view.getProperties().put(disableFocusHandlingKey, true);
        view.requestFocus();

        entry = view.getEntry();

        if (entry != null) {

            if (!isMultiSelect(evt) && !getSelections().contains(entry)) {
                clearSelection();
            }

            if (isMultiSelect(evt) && getSelections().contains(entry)) {
                getSelections().remove(entry);
            } else if (!getSelections().contains(entry)) {
                getSelections().add(entry);
            }
        }

        view.getProperties().remove(disableFocusHandlingKey);

    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:39,代码来源:DateControl.java

示例2: startDrag

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void startDrag(MouseEvent evt) {
    EventTarget target = evt.getTarget();
    if (isScrollBar(target) || !isOnEntry(target)) {
        return;
    }
    Dragboard db = startDragAndDrop(TransferMode.MOVE);
    ClipboardContent content = new ClipboardContent();

    /*
     * We have to add some content, otherwise drag over will not be called.
     */
    content.putString("dummy"); //$NON-NLS-1$
    db.setContent(content);
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:15,代码来源:AutoScrollPane.java

示例3: startDrag

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void startDrag(MouseEvent evt) {
    EventTarget target = evt.getTarget();
    if (!isOnEntry(target)) {
        return;
    }
    Dragboard db = startDragAndDrop(TransferMode.MOVE);
    ClipboardContent content = new ClipboardContent();

    /*
     * We have to add some content, otherwise drag over will not be called.
     */
    content.putString("dummy"); //$NON-NLS-1$
    db.setContent(content);
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:15,代码来源:DayViewScrollPane.java

示例4: initDragModeAndHandle

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void initDragModeAndHandle(MouseEvent evt) {
    dragMode = null;
    handle = null;

    if (!(evt.getTarget() instanceof EntryViewBase)) {
        return;
    }

    dayEntryView = (DayEntryView) evt.getTarget();

    entry = dayEntryView.getEntry();
    Calendar calendar = entry.getCalendar();
    if (calendar.isReadOnly()) {
        return;
    }

    double y = evt.getY() - dayEntryView.getBoundsInParent().getMinY();

    LOGGER.finer("y-coordinate inside entry view: " + y);

    if (y > dayEntryView.getHeight() - 5) {
        if (dayView.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dayView, entry, DateControl.EditOperation.CHANGE_END))) {
            dragMode = DraggedEntry.DragMode.END_TIME;
            handle = Handle.BOTTOM;
        }
    } else if (y < 5) {
        if (dayView.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dayView, entry, DateControl.EditOperation.CHANGE_START))) {
            dragMode = DraggedEntry.DragMode.START_TIME;
            handle = Handle.TOP;
        }
    } else {
        if (dayView.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dayView, entry, DateControl.EditOperation.MOVE))) {
            dragMode = DraggedEntry.DragMode.START_AND_END_TIME;
            handle = Handle.CENTER;
        }
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:38,代码来源:DayViewEditController.java

示例5: processMouseClick

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
/**
 * Handle a click to a tab.
 */
private void processMouseClick(@NotNull final MouseEvent event) {
    final EventTarget target = event.getTarget();
    if (!(target instanceof Node)) return;

    final Node node = (Node) target;

    if (!(node instanceof Text) || node.getStyleClass().contains("tab-container")) {
        return;
    }

    final Parent label = node.getParent();

    if (!(label instanceof Label)) {
        return;
    }

    final Parent tabContainer = label.getParent();

    if (!tabContainer.getStyleClass().contains("tab-container")) {
        return;
    }

    if (isChangingTab()) {
        setChangingTab(false);
        return;
    }

    processExpandOrCollapse();
}
 
开发者ID:JavaSaBr,项目名称:jmonkeybuilder,代码行数:33,代码来源:TabToolComponent.java

示例6: mousePressed

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@Override protected void mousePressed(MouseEvent me) {
    Node target = (Node) me.getTarget();
    if (onCloseButton(target)) {
        recorder.recordSelect(this, getTextForTab((TabPane) node, getTab(target)) + "::close");
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:7,代码来源:RFXTabPane.java


注:本文中的javafx.scene.input.MouseEvent.getTarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。