本文整理汇总了Java中sun.awt.SunToolkit.createNewAppContext方法的典型用法代码示例。如果您正苦于以下问题:Java SunToolkit.createNewAppContext方法的具体用法?Java SunToolkit.createNewAppContext怎么用?Java SunToolkit.createNewAppContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.awt.SunToolkit
的用法示例。
在下文中一共展示了SunToolkit.createNewAppContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import sun.awt.SunToolkit; //导入方法依赖的package包/类
public static void main(final String[] args) throws Exception {
final Thread t1 = new Thread(new ThreadGroup("firstGroup"), () -> {
app1 = SunToolkit.createNewAppContext();
test(true);
});
final Thread t2 = new Thread(new ThreadGroup("secondGroup"), () -> {
app2 = SunToolkit.createNewAppContext();
test(false);
});
t1.start();
t2.start();
t1.join();
t2.join();
app1.dispose();
app2.dispose();
}
示例2: run
import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void run() {
appContext = SunToolkit.createNewAppContext();
created = true;
synchronized(syncObject) {
syncObject.notifyAll();
}
}
示例3: main
import sun.awt.SunToolkit; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
editor = new JEditorPane("text/html", "Hello world!");
}
});
Thread thread = new Thread(new ThreadGroup("Some ThreadGroup"), new Runnable() {
public void run() {
SunToolkit.createNewAppContext();
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
editor.setText("Hello world!");
}
});
} catch (Exception e) {
throw new RuntimeException(e);
}
}
});
thread.start();
thread.join();
}
示例4: run
import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void run() {
SunToolkit.createNewAppContext();
if (LayoutQueue.getDefaultQueue() == DEFAULT) {
throw new RuntimeException("Sharing detected");
}
LayoutQueue.setDefaultQueue(new LayoutQueue());
}
示例5: run
import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void run() {
SunToolkit.createNewAppContext();
ToolTipManager manager = ToolTipManager.sharedInstance();
if (DISMISS != manager.getDismissDelay()) {
throw new Error("shared dismiss delay");
}
if (INITIAL != manager.getInitialDelay()) {
throw new Error("shared initial delay");
}
if (RESHOW != manager.getReshowDelay()) {
throw new Error("shared reshow delay");
}
}
示例6: run
import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void run() {
SunToolkit.createNewAppContext();
try {
testUIMap();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例7: createAppContext
import sun.awt.SunToolkit; //导入方法依赖的package包/类
private void createAppContext() {
isCreated = false;
final Runnable runnable = new Runnable() {
public void run() {
appContext = SunToolkit.createNewAppContext();
synchronized (lock) {
isCreated = true;
lock.notifyAll();
}
}
};
final Thread thread = new Thread(threadGroup, runnable, "creates app context");
synchronized (lock) {
thread.start();
while (!isCreated) {
try {
lock.wait();
} catch (InterruptedException ie) {
ie.printStackTrace();
}
}
}
if (appContext == null) {
throw new RuntimeException("failed to create app context.");
} else {
System.out.println("app context was created.");
}
}
示例8: run
import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void run() {
SunToolkit.createNewAppContext();
try {
validate();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例9: run
import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void run() {
SunToolkit.createNewAppContext();
try {
setSelectedUIMethod.invoke(null, null, false, false, false, false);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例10: run
import sun.awt.SunToolkit; //导入方法依赖的package包/类
@Override
public void run() {
contextToDispose = SunToolkit.createNewAppContext();
Frame f = new Frame();
f.setSize(300, 300);
f.setLocationRelativeTo(null);
f.setVisible(true);
thread = new Thread(() -> {
while(true);
});
thread.start();
sync();
}
示例11: main
import sun.awt.SunToolkit; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
SunToolkit.createNewAppContext();
new Test8012933().test();
}
示例12: run
import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void run() {
SunToolkit.createNewAppContext();
test();
}
示例13: run
import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void run() {
SunToolkit.createNewAppContext();
IS_PALETTE = JInternalFrame.CONTENT_PANE_PROPERTY;
}
示例14: run
import sun.awt.SunToolkit; //导入方法依赖的package包/类
public void run() {
SunToolkit.createNewAppContext();
JSlider slider = new JSlider();
test(slider);
tickLength = -10000;
}
示例15: main
import sun.awt.SunToolkit; //导入方法依赖的package包/类
public static void main(String... args) throws Exception {
ThreadGroup rootTG = Thread.currentThread().getThreadGroup();
while (rootTG.getParent() != null) {
rootTG = rootTG.getParent();
}
ThreadGroup tg = new ThreadGroup(rootTG, "FakeApplet");
final Thread t1 = new Thread(tg, "createNewAppContext") {
@Override
public void run() {
try {
AppContext context = SunToolkit.createNewAppContext();
} catch(Throwable t) {
thrown = t;
}
}
};
t1.start();
t1.join();
if (thrown != null) {
throw new RuntimeException("Unexpected exception: " + thrown, thrown);
}
Thread t2 = new Thread(tg, "BugDetector") {
@Override
public void run() {
try {
Logger.getLogger("foo").info("Done");
} catch (Throwable x) {
thrown = x;
}
}
};
System.setSecurityManager(new SecurityManager());
t2.start();
t2.join();
if (thrown != null) {
throw new RuntimeException("Test failed: " + thrown, thrown);
}
}