Java Code Examples for sun.awt.SunToolkit#targetToAppContext()
The following examples show how to use
sun.awt.SunToolkit#targetToAppContext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SwingPaintEventDispatcher.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
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); }
Example 2
Source File: SunDropTargetContextPeer.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
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; } }
Example 3
Source File: InputMethodEvent.java From Java8CN with Apache License 2.0 | 5 votes |
/** * 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); }
Example 4
Source File: InputMethodEvent.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 5
Source File: SwingPaintEventDispatcher.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
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); }
Example 6
Source File: InputMethodEvent.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 7
Source File: SunDropTargetContextPeer.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
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; } }
Example 8
Source File: ExecutableInputMethodManager.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
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); } }
Example 9
Source File: InputMethodEvent.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * 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); }
Example 10
Source File: SunDropTargetContextPeer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
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; } }
Example 11
Source File: SunDropTargetContextPeer.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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; } }
Example 12
Source File: InputMethodEvent.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * 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); }
Example 13
Source File: SwingPaintEventDispatcher.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
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); }
Example 14
Source File: WindowEvent.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 3 votes |
/** * 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; }
Example 15
Source File: WindowEvent.java From TencentKona-8 with GNU General Public License v2.0 | 3 votes |
/** * 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; }
Example 16
Source File: WindowEvent.java From Bytecoder with Apache License 2.0 | 3 votes |
/** * 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; }
Example 17
Source File: WindowEvent.java From jdk1.8-source-analysis with Apache License 2.0 | 3 votes |
/** * 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; }
Example 18
Source File: FocusEvent.java From openjdk-8-source with GNU General Public License v2.0 | 3 votes |
/** * 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; }
Example 19
Source File: FocusEvent.java From openjdk-jdk8u with GNU General Public License v2.0 | 3 votes |
/** * 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; }
Example 20
Source File: WindowEvent.java From openjdk-8-source with GNU General Public License v2.0 | 3 votes |
/** * 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; }