提交 736effa1 编写于 作者: S serb

6470361: Swing's Threading Policy example does not compile

Reviewed-by: azvegint, alexsch
上级 c232bd17
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<HEAD> <HEAD>
<!-- <!--
Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it This code is free software; you can redistribute it and/or modify it
...@@ -68,6 +68,8 @@ invokeLater} method schedules a {@code Runnable} to be processed on ...@@ -68,6 +68,8 @@ invokeLater} method schedules a {@code Runnable} to be processed on
the event dispatching thread. The following two examples work equally the event dispatching thread. The following two examples work equally
well for transferring control and starting up a Swing application: well for transferring control and starting up a Swing application:
<pre> <pre>
import javax.swing.SwingUtilities;
public class MyApp implements Runnable { public class MyApp implements Runnable {
public void run() { public void run() {
// Invoked on the event dispatching thread. // Invoked on the event dispatching thread.
...@@ -75,16 +77,18 @@ public class MyApp implements Runnable { ...@@ -75,16 +77,18 @@ public class MyApp implements Runnable {
} }
public static void main(String[] args) { public static void main(String[] args) {
SwingUtilities.invokeLater(new MyApp(args)); SwingUtilities.invokeLater(new MyApp());
} }
} }
</pre> </pre>
Or: Or:
<pre> <pre>
import javax.swing.SwingUtilities;
public class MyApp { public class MyApp {
MyApp(String[] args) { MyApp(String[] args) {
// Invoked on the event dispatching thread. Do any initialization // Invoked on the event dispatching thread.
// here. // Do any initialization here.
} }
public void show() { public void show() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册