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


Java AWTAutoShutdown.notifyToolkitThreadBusy方法代码示例

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


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

示例1: WToolkit

import sun.awt.AWTAutoShutdown; //导入方法依赖的package包/类
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    // Find a root TG and attach Appkit thread to it
    ThreadGroup rootTG = AccessController.doPrivileged(
            (PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
    if (!startToolkitThread(this, rootTG)) {
        Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:44,代码来源:WToolkit.java

示例2: WToolkit

import sun.awt.AWTAutoShutdown; //导入方法依赖的package包/类
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    // Find a root TG and attach toolkit thread to it
    ThreadGroup rootTG = AccessController.doPrivileged(
            (PrivilegedAction<ThreadGroup>) ThreadGroupUtils::getRootThreadGroup);
    if (!startToolkitThread(this, rootTG)) {
        String name = "AWT-Windows";
        Thread toolkitThread = new Thread(rootTG, this, name, 0, false);
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:45,代码来源:WToolkit.java

示例3: WToolkit

import sun.awt.AWTAutoShutdown; //导入方法依赖的package包/类
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    if (!startToolkitThread(this)) {
        Thread toolkitThread = new Thread(this, "AWT-Windows");
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:43,代码来源:WToolkit.java

示例4: MToolkit

import sun.awt.AWTAutoShutdown; //导入方法依赖的package包/类
public MToolkit() {
    super();
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("MToolkit construction");
    }
    if (!GraphicsEnvironment.isHeadless()) {
        String mainClassName = null;

        StackTraceElement trace[] = (new Throwable()).getStackTrace();
        int bottom = trace.length - 1;
        if (bottom >= 0) {
            mainClassName = trace[bottom].getClassName();
        }
        if (mainClassName == null || mainClassName.equals("")) {
            mainClassName = "AWT";
        }

        init(mainClassName);
        //SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

        Thread toolkitThread = new Thread(this, "AWT-Motif");
        toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
        toolkitThread.setDaemon(true);

        PrivilegedAction<Void> a = new PrivilegedAction<Void>() {
            public Void run() {
                ThreadGroup mainTG = Thread.currentThread().getThreadGroup();
                ThreadGroup parentTG = mainTG.getParent();

                while (parentTG != null) {
                    mainTG = parentTG;
                    parentTG = mainTG.getParent();
                }
                Thread shutdownThread = new Thread(mainTG, new Runnable() {
                        public void run() {
                            shutdown();
                        }
                    }, "Shutdown-Thread");
                shutdownThread.setContextClassLoader(null);
                Runtime.getRuntime().addShutdownHook(shutdownThread);
                return null;
            }
        };
        AccessController.doPrivileged(a);

        /*
         * Fix for 4701990.
         * AWTAutoShutdown state must be changed before the toolkit thread
         * starts to avoid race condition.
         */
        AWTAutoShutdown.notifyToolkitThreadBusy();

        toolkitThread.start();
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:56,代码来源:MToolkit.java

示例5: WToolkit

import sun.awt.AWTAutoShutdown; //导入方法依赖的package包/类
public WToolkit() {
    // Startup toolkit threads
    if (PerformanceLogger.loggingEnabled()) {
        PerformanceLogger.setTime("WToolkit construction");
    }

    sun.java2d.Disposer.addRecord(anchor, new ToolkitDisposer());

    /*
     * Fix for 4701990.
     * AWTAutoShutdown state must be changed before the toolkit thread
     * starts to avoid race condition.
     */
    AWTAutoShutdown.notifyToolkitThreadBusy();

    // Find a root TG and attach Appkit thread to it
    ThreadGroup rootTG = AccessController.doPrivileged(new PrivilegedAction<ThreadGroup>() {
                @Override
                public ThreadGroup run() {
                    return ThreadGroupUtils.getRootThreadGroup();
                }
            });
    if (!startToolkitThread(this, rootTG)) {
        Thread toolkitThread = new Thread(rootTG, this, "AWT-Windows");
        toolkitThread.setDaemon(true);
        toolkitThread.start();
    }

    try {
        synchronized(this) {
            while(!inited) {
                wait();
            }
        }
    } catch (InterruptedException x) {
        // swallow the exception
    }

    SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);

    // Enabled "live resizing" by default.  It remains controlled
    // by the native system though.
    setDynamicLayout(true);

    areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
    //set system property if not yet assigned
    System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
    setExtraMouseButtonsEnabledNative(areExtraMouseButtonsEnabled);
}
 
开发者ID:greghaskins,项目名称:openjdk-jdk7u-jdk,代码行数:50,代码来源:WToolkit.java


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