本文整理汇总了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()]);
}
示例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()));
}
}
}
}
}
示例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()));
}
}
}
}
}
示例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);
}
}
}
示例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);
}
}
}
}
}
示例6: invokeOnEachAppContext
import sun.awt.AppContext; //导入方法依赖的package包/类
private void invokeOnEachAppContext(Runnable runnable) {
for (AppContext appContext : AppContext.getAppContexts()) {
SunToolkit.invokeLaterOnAppContext(appContext, runnable);
}
}