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


Java SunToolkit.targetToAppContext方法代码示例

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


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

示例1: getMostRecentEventTimeForSource

import sun.awt.SunToolkit; //导入方法依赖的package包/类
/**
 * Get the most recent event time in the {@code EventQueue} which the {@code source}
 * belongs to.
 *
 * @param source the source of the event
 * @exception  IllegalArgumentException  if source is null.
 * @return most recent event time in the {@code EventQueue}
 */
private static long getMostRecentEventTimeForSource(Object source) {
    if (source == null) {
        // throw the IllegalArgumentException to conform to EventObject spec
        throw new IllegalArgumentException("null source");
    }
    AppContext appContext = SunToolkit.targetToAppContext(source);
    EventQueue eventQueue = SunToolkit.getSystemEventQueueImplPP(appContext);
    return AWTAccessor.getEventQueueAccessor().getMostRecentEventTime(eventQueue);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:InputMethodEvent.java

示例2: postDropTargetEvent

import sun.awt.SunToolkit; //导入方法依赖的package包/类
protected int postDropTargetEvent(final Component component,
                                  final int x, final int y,
                                  final int dropAction,
                                  final int actions,
                                  final long[] formats,
                                  final long nativeCtxt,
                                  final int eventID,
                                  final boolean dispatchType) {
    AppContext appContext = SunToolkit.targetToAppContext(component);

    EventDispatcher dispatcher =
        new EventDispatcher(this, dropAction, actions, formats, nativeCtxt,
                            dispatchType);

    SunDropTargetEvent event =
        new SunDropTargetEvent(component, eventID, x, y, dispatcher);

    if (dispatchType == SunDropTargetContextPeer.DISPATCH_SYNC) {
        DataTransferer.getInstance().getToolkitThreadBlockedHandler().lock();
    }

    // schedule callback
    SunToolkit.postEvent(appContext, event);

    eventPosted(event);

    if (dispatchType == SunDropTargetContextPeer.DISPATCH_SYNC) {
        while (!dispatcher.isDone()) {
            DataTransferer.getInstance().getToolkitThreadBlockedHandler().enter();
        }

        DataTransferer.getInstance().getToolkitThreadBlockedHandler().unlock();

        // return target's response
        return dispatcher.getReturnValue();
    } else {
        return 0;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:SunDropTargetContextPeer.java

示例3: showInputMethodMenuOnRequesterEDT

import sun.awt.SunToolkit; //导入方法依赖的package包/类
private void showInputMethodMenuOnRequesterEDT(Component requester)
    throws InterruptedException, InvocationTargetException {

    if (requester == null){
        return;
    }

    class AWTInvocationLock {}
    Object lock = new AWTInvocationLock();

    InvocationEvent event =
            new InvocationEvent(requester,
                                new Runnable() {
                                    public void run() {
                                        showInputMethodMenu();
                                    }
                                },
                                lock,
                                true);

    AppContext requesterAppContext = SunToolkit.targetToAppContext(requester);
    synchronized (lock) {
        SunToolkit.postEvent(requesterAppContext, event);
        while (!event.isDispatched()) {
            lock.wait();
        }
    }

    Throwable eventThrowable = event.getThrowable();
    if (eventThrowable != null) {
        throw new InvocationTargetException(eventThrowable);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:ExecutableInputMethodManager.java

示例4: queueSurfaceDataReplacing

import sun.awt.SunToolkit; //导入方法依赖的package包/类
public boolean queueSurfaceDataReplacing(Component c, Runnable r) {
    if (c instanceof RootPaneContainer) {
        AppContext appContext = SunToolkit.targetToAppContext(c);
        RepaintManager.currentManager(appContext).
                nativeQueueSurfaceDataRunnable(appContext, c, r);
        return true;
    }
    return super.queueSurfaceDataReplacing(c, r);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:SwingPaintEventDispatcher.java

示例5: getOppositeComponent

import sun.awt.SunToolkit; //导入方法依赖的package包/类
/**
 * Returns the other Component involved in this focus change. For a
 * FOCUS_GAINED event, this is the Component that lost focus. For a
 * FOCUS_LOST event, this is the Component that gained focus. If this
 * focus change occurs with a native application, with a Java application
 * in a different VM or context, or with no other Component, then null is
 * returned.
 *
 * @return the other Component involved in the focus change, or null
 * @since 1.4
 */
public Component getOppositeComponent() {
    if (opposite == null) {
        return null;
    }

    return (SunToolkit.targetToAppContext(opposite) ==
            AppContext.getAppContext())
        ? opposite
        : null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:FocusEvent.java

示例6: getOppositeWindow

import sun.awt.SunToolkit; //导入方法依赖的package包/类
/**
 * Returns the other Window involved in this focus or activation change.
 * For a WINDOW_ACTIVATED or WINDOW_GAINED_FOCUS event, this is the Window
 * that lost activation or focus. For a WINDOW_DEACTIVATED or
 * WINDOW_LOST_FOCUS event, this is the Window that gained activation or
 * focus. For any other type of WindowEvent, or if the focus or activation
 * change occurs with a native application, with a Java application in a
 * different VM or context, or with no other Window, null is returned.
 *
 * @return the other Window involved in the focus or activation change, or
 *         null
 * @since 1.4
 */
public Window getOppositeWindow() {
    if (opposite == null) {
        return null;
    }

    return (SunToolkit.targetToAppContext(opposite) ==
            AppContext.getAppContext())
        ? opposite
        : null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:WindowEvent.java

示例7: getOppositeComponent

import sun.awt.SunToolkit; //导入方法依赖的package包/类
/**
 * Returns the other Component involved in this focus change. For a
 * FOCUS_GAINED event, this is the Component that lost focus. For a
 * FOCUS_LOST event, this is the Component that gained focus. If this
 * focus change occurs with a native application, with a Java application
 * in a different VM or context, or with no other Component, then null is
 * returned.
 *
 * @return the other Component involved in the focus change, or null
 * @since 1.4
 */
public Component getOppositeComponent() {
    if (opposite == null) {
        return null;
    }

    return (SunToolkit.targetToAppContext(opposite) ==
            AppContext.getAppContext())
            ? opposite
            : null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:FocusEvent.java


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