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


Java AppContext.getAppContexts方法代码示例

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


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

示例1: getValidWindows

import sun.awt.AppContext; //导入方法依赖的package包/类
private Window[] getValidWindows() {
    List<Window> valid = new ArrayList<Window>();
    Set<AppContext> appContexts = AppContext.getAppContexts();
    for (AppContext appContext : appContexts) {
        Window[] windows = getWindows(appContext);
        for (Window window : windows) {
            if (window.getClass().getName().equals("javax.swing.SwingUtilities$SharedOwnerFrame")) {
                continue;
            }
            if (window.getClass().getName().equals("javax.swing.Popup$HeavyWeightWindow")) {
                continue;
            }
            if (window.isVisible()) {
                valid.add(window);
            }
        }
    }
    return valid.toArray(new Window[valid.size()]);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:JavaTargetLocator.java

示例2: scheduleDisplayChanges

import sun.awt.AppContext; //导入方法依赖的package包/类
private void scheduleDisplayChanges() {
    // To avoid threading problems, we notify each RepaintManager
    // on the thread it was created on.
    for (Object c : AppContext.getAppContexts()) {
        AppContext context = (AppContext) c;
        synchronized(context) {
            if (!context.isDisposed()) {
                EventQueue eventQueue = (EventQueue)context.get(
                    AppContext.EVENT_QUEUE_KEY);
                if (eventQueue != null) {
                    eventQueue.postEvent(new InvocationEvent(
                        Toolkit.getDefaultToolkit(),
                        new DisplayChangedRunnable()));
                }
            }
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:RepaintManager.java

示例3: scheduleDisplayChanges

import sun.awt.AppContext; //导入方法依赖的package包/类
private static void scheduleDisplayChanges() {
    // To avoid threading problems, we notify each RepaintManager
    // on the thread it was created on.
    for (AppContext context : AppContext.getAppContexts()) {
        synchronized(context) {
            if (!context.isDisposed()) {
                EventQueue eventQueue = (EventQueue)context.get(
                    AppContext.EVENT_QUEUE_KEY);
                if (eventQueue != null) {
                    eventQueue.postEvent(new InvocationEvent(
                        Toolkit.getDefaultToolkit(),
                        new DisplayChangedRunnable()));
                }
            }
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:RepaintManager.java

示例4: firePropertyChange

import sun.awt.AppContext; //导入方法依赖的package包/类
@Override
public void firePropertyChange(final PropertyChangeEvent evt) {
    Object oldValue = evt.getOldValue();
    Object newValue = evt.getNewValue();
    String propertyName = evt.getPropertyName();
    if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
        return;
    }
    Runnable updater = new Runnable() {
        public void run() {
            PropertyChangeSupport pcs = (PropertyChangeSupport)
                    AppContext.getAppContext().get(PROP_CHANGE_SUPPORT_KEY);
            if (null != pcs) {
                pcs.firePropertyChange(evt);
            }
        }
    };
    final AppContext currentAppContext = AppContext.getAppContext();
    for (AppContext appContext : AppContext.getAppContexts()) {
        if (null == appContext || appContext.isDisposed()) {
            continue;
        }
        if (currentAppContext == appContext) {
            updater.run();
        } else {
            final PeerEvent e = new PeerEvent(source, updater, PeerEvent.ULTIMATE_PRIORITY_EVENT);
            SunToolkit.postEvent(appContext, e);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:Toolkit.java

示例5: checkChange

import sun.awt.AppContext; //导入方法依赖的package包/类
/**
 * Checks change of the {@code DataFlavor}s and, if necessary,
 * posts notifications on {@code FlavorEvent}s to the
 * AppContexts' EDTs.
 * The parameter {@code formats} is null iff we have just
 * failed to get formats available on the clipboard.
 *
 * @param formats data formats that have just been retrieved from
 *        this clipboard
 */
protected final void checkChange(final long[] formats) {
    if (Arrays.equals(formats, currentFormats)) {
        // we've been able to successfully get available on the clipboard
        // DataFlavors this and previous time and they are coincident;
        // don't notify
        return;
    }
    currentFormats = formats;

    for (final AppContext appContext : AppContext.getAppContexts()) {
        if (appContext == null || appContext.isDisposed()) {
            continue;
        }
        Set<FlavorListener> flavorListeners = getFlavorListeners(appContext);
        if (flavorListeners != null) {
            for (FlavorListener listener : flavorListeners) {
                if (listener != null) {
                    PeerEvent peerEvent = new PeerEvent(this,
                            () -> listener.flavorsChanged(new FlavorEvent(SunClipboard.this)),
                            PeerEvent.PRIORITY_EVENT);
                    SunToolkit.postEvent(appContext, peerEvent);
                }
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:37,代码来源:SunClipboard.java

示例6: invokeOnEachAppContext

import sun.awt.AppContext; //导入方法依赖的package包/类
private void invokeOnEachAppContext(Runnable runnable) {
    for (AppContext appContext : AppContext.getAppContexts()) {
        SunToolkit.invokeLaterOnAppContext(appContext, runnable);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:XSystemTrayPeer.java


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