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


Java Component.getDropTarget方法代码示例

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


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

示例1: processEnterMessage

import java.awt.Component; //导入方法依赖的package包/类
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();

    if (currentDTC != null) { // some wreckage from last time
        currentDTC.removeNotify();
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        currentDTC.addNotify(this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:SunDropTargetContextPeer.java

示例2: processExitMessage

import java.awt.Component; //导入方法依赖的package包/类
/**
 *
 */

protected void processExitMessage(SunDropTargetEvent event) {
    Component         c   = (Component)event.getSource();
    DropTarget        dt  = c.getDropTarget();
    DropTargetContext dtc = null;

    if (dt == null) {
        currentDT = null;
        currentT  = null;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = null;

        return;
    }

    if (dt != currentDT) {

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDT  = dt;
        currentDTC = dt.getDropTargetContext();

        currentDTC.addNotify(this);
    }

    dtc = currentDTC;

    if (dt.isActive()) try {
        ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc));
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        currentA  = DnDConstants.ACTION_NONE;
        currentSA = DnDConstants.ACTION_NONE;
        currentDA = DnDConstants.ACTION_NONE;
        currentDT = null;
        currentT  = null;

        currentDTC.removeNotify();
        currentDTC = null;

        local = null;

        dragRejected = false;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:56,代码来源:SunDropTargetContextPeer.java

示例3: processMotionMessage

import java.awt.Component; //导入方法依赖的package包/类
/**
 *
 */

protected void processMotionMessage(SunDropTargetEvent event,
                                  boolean operationChanged) {
    Component         c    = (Component)event.getSource();
    Point             hots = event.getPoint();
    int               id   = event.getID();
    DropTarget        dt   = c.getDropTarget();
    DropTargetContext dtc  = null;

    if (c.isShowing() && (dt != null) && dt.isActive()) {
        if (currentDT != dt) {
            if (currentDTC != null) {
                currentDTC.removeNotify();
            }

            currentDT  = dt;
            currentDTC = null;
        }

        dtc = currentDT.getDropTargetContext();
        if (dtc != currentDTC) {
            if (currentDTC != null) {
                currentDTC.removeNotify();
            }

            currentDTC = dtc;
            currentDTC.addNotify(this);
        }

        currentA = currentDT.getDefaultActions();

        try {
            DropTargetDragEvent dtde = new DropTargetDragEvent(dtc,
                                                               hots,
                                                               currentDA,
                                                               currentSA);
            DropTargetListener dtl = (DropTargetListener)dt;
            if (operationChanged) {
                dtl.dropActionChanged(dtde);
            } else {
                dtl.dragOver(dtde);
            }

            if (dragRejected) {
                currentDA = DnDConstants.ACTION_NONE;
            }
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDA = DnDConstants.ACTION_NONE;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:58,代码来源:SunDropTargetContextPeer.java

示例4: processDropMessage

import java.awt.Component; //导入方法依赖的package包/类
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;

        if (currentDTC != null) {
            currentDTC.removeNotify();
        }

        currentDTC = dtc;
        currentDTC.addNotify(this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:51,代码来源:SunDropTargetContextPeer.java

示例5: processEnterMessage

import java.awt.Component; //导入方法依赖的package包/类
/**
 * actual processing on EventQueue Thread
 */

protected void processEnterMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    DropTarget dt   = c.getDropTarget();
    Point      hots = event.getPoint();

    local = getJVMLocalSourceTransferable();
    DropTargetContextAccessor acc =
            AWTAccessor.getDropTargetContextAccessor();
    if (currentDTC != null) { // some wreckage from last time
        acc.reset(currentDTC);
        currentDTC = null;
    }

    if (c.isShowing() && dt != null && dt.isActive()) {
        currentDT  = dt;
        currentDTC = currentDT.getDropTargetContext();

        acc.setDropTargetContextPeer(currentDTC, this);

        currentA   = dt.getDefaultActions();

        try {
            ((DropTargetListener)dt).dragEnter(new DropTargetDragEvent(currentDTC,
                                                                       hots,
                                                                       currentDA,
                                                                       currentSA));
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDT  = null;
        currentDTC = null;
        currentDA   = DnDConstants.ACTION_NONE;
        currentSA   = DnDConstants.ACTION_NONE;
        currentA   = DnDConstants.ACTION_NONE;
    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:44,代码来源:SunDropTargetContextPeer.java

示例6: processExitMessage

import java.awt.Component; //导入方法依赖的package包/类
/**
 *
 */

protected void processExitMessage(SunDropTargetEvent event) {
    Component         c   = (Component)event.getSource();
    DropTarget        dt  = c.getDropTarget();
    DropTargetContext dtc = null;
    DropTargetContextAccessor acc =
            AWTAccessor.getDropTargetContextAccessor();

    if (dt == null) {
        currentDT = null;
        currentT  = null;

        if (currentDTC != null) {
            acc.reset(currentDTC);
        }

        currentDTC = null;

        return;
    }

    if (dt != currentDT) {

        if (currentDTC != null) {
            acc.reset(currentDTC);
        }

        currentDT  = dt;
        currentDTC = dt.getDropTargetContext();

        acc.setDropTargetContextPeer(currentDTC, this);
    }

    dtc = currentDTC;

    if (dt.isActive()) try {
        ((DropTargetListener)dt).dragExit(new DropTargetEvent(dtc));
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        currentA  = DnDConstants.ACTION_NONE;
        currentSA = DnDConstants.ACTION_NONE;
        currentDA = DnDConstants.ACTION_NONE;
        currentDT = null;
        currentT  = null;

        acc.reset(currentDTC);
        currentDTC = null;

        local = null;

        dragRejected = false;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:58,代码来源:SunDropTargetContextPeer.java

示例7: processMotionMessage

import java.awt.Component; //导入方法依赖的package包/类
/**
 *
 */

protected void processMotionMessage(SunDropTargetEvent event,
                                  boolean operationChanged) {
    Component         c    = (Component)event.getSource();
    Point             hots = event.getPoint();
    int               id   = event.getID();
    DropTarget        dt   = c.getDropTarget();
    DropTargetContext dtc  = null;
    DropTargetContextAccessor acc =
            AWTAccessor.getDropTargetContextAccessor();

    if (c.isShowing() && (dt != null) && dt.isActive()) {
        if (currentDT != dt) {
            if (currentDTC != null) {
                acc.reset(currentDTC);
            }

            currentDT  = dt;
            currentDTC = null;
        }

        dtc = currentDT.getDropTargetContext();
        if (dtc != currentDTC) {
            if (currentDTC != null) {
                acc.reset(currentDTC);
            }

            currentDTC = dtc;
            acc.setDropTargetContextPeer(currentDTC, this);
        }

        currentA = currentDT.getDefaultActions();

        try {
            DropTargetDragEvent dtde = new DropTargetDragEvent(dtc,
                                                               hots,
                                                               currentDA,
                                                               currentSA);
            DropTargetListener dtl = (DropTargetListener)dt;
            if (operationChanged) {
                dtl.dropActionChanged(dtde);
            } else {
                dtl.dragOver(dtde);
            }

            if (dragRejected) {
                currentDA = DnDConstants.ACTION_NONE;
            }
        } catch (Exception e) {
            e.printStackTrace();
            currentDA = DnDConstants.ACTION_NONE;
        }
    } else {
        currentDA = DnDConstants.ACTION_NONE;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:60,代码来源:SunDropTargetContextPeer.java

示例8: processDropMessage

import java.awt.Component; //导入方法依赖的package包/类
/**
 *
 */

protected void processDropMessage(SunDropTargetEvent event) {
    Component  c    = (Component)event.getSource();
    Point      hots = event.getPoint();
    DropTarget dt   = c.getDropTarget();

    dropStatus   = STATUS_WAIT; // drop pending ACK
    dropComplete = false;

    if (c.isShowing() && dt != null && dt.isActive()) {
        DropTargetContext dtc = dt.getDropTargetContext();

        currentDT = dt;
        DropTargetContextAccessor acc =
                AWTAccessor.getDropTargetContextAccessor();

        if (currentDTC != null) {
            acc.reset(currentDTC);
        }

        currentDTC = dtc;
        acc.setDropTargetContextPeer(currentDTC, this);
        currentA = dt.getDefaultActions();

        synchronized(_globalLock) {
            if ((local = getJVMLocalSourceTransferable()) != null)
                setCurrentJVMLocalSourceTransferable(null);
        }

        dropInProcess = true;

        try {
            ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                  hots,
                                                                  currentDA,
                                                                  currentSA,
                                                                  local != null));
        } finally {
            if (dropStatus == STATUS_WAIT) {
                rejectDrop();
            } else if (dropComplete == false) {
                dropComplete(false);
            }
            dropInProcess = false;
        }
    } else {
        rejectDrop();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:53,代码来源:SunDropTargetContextPeer.java


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