1
public
class
CmdSplash
{
2 /***/ /**
3 * @param str
4 */
5 public static void main(String[]str) {
6 System.out.println( " test " );
7 }
8
9 }
10
2 /***/ /**
3 * @param str
4 */
5 public static void main(String[]str) {
6 System.out.println( " test " );
7 }
8
9 }
10
1
import
org.eclipse.swt.SWT;
2 import org.eclipse.swt.widgets.Display;
3 import org.eclipse.swt.widgets.Shell;
4
5
6 public class SwtSplash extends Shell {
7
8 /***/ /**
9 *Launchtheapplication
10 * @param args
11 */
12 public static void main(Stringargs[]) {
13 try {
14 Displaydisplay = Display.getDefault();
15 SwtSplashshell = new SwtSplash(display,SWT.SHELL_TRIM);
16 shell.open();
17 shell.layout();
18 while ( ! shell.isDisposed()) {
19 if ( ! display.readAndDispatch())
20 display.sleep();
21 }
22 } catch (Exceptione) {
23 e.printStackTrace();
24 }
25 }
26
27 /***/ /**
28 *Createtheshell
29 * @param display
30 * @param style
31 */
32 public SwtSplash(Displaydisplay, int style) {
33 super (display,style);
34 createContents();
35 }
36
37 /***/ /**
38 *Createcontentsofthewindow
39 */
40 protected void createContents() {
41 setText( " SWTApplication " );
42 setSize( 500 , 375 );
43 //
44 }
45
46 @Override
47 protected void checkSubclass() {
48 // DisablethecheckthatpreventssubclassingofSWTcomponents
49 }
50
51 }
52
2 import org.eclipse.swt.widgets.Display;
3 import org.eclipse.swt.widgets.Shell;
4
5
6 public class SwtSplash extends Shell {
7
8 /***/ /**
9 *Launchtheapplication
10 * @param args
11 */
12 public static void main(Stringargs[]) {
13 try {
14 Displaydisplay = Display.getDefault();
15 SwtSplashshell = new SwtSplash(display,SWT.SHELL_TRIM);
16 shell.open();
17 shell.layout();
18 while ( ! shell.isDisposed()) {
19 if ( ! display.readAndDispatch())
20 display.sleep();
21 }
22 } catch (Exceptione) {
23 e.printStackTrace();
24 }
25 }
26
27 /***/ /**
28 *Createtheshell
29 * @param display
30 * @param style
31 */
32 public SwtSplash(Displaydisplay, int style) {
33 super (display,style);
34 createContents();
35 }
36
37 /***/ /**
38 *Createcontentsofthewindow
39 */
40 protected void createContents() {
41 setText( " SWTApplication " );
42 setSize( 500 , 375 );
43 //
44 }
45
46 @Override
47 protected void checkSubclass() {
48 // DisablethecheckthatpreventssubclassingofSWTcomponents
49 }
50
51 }
52
按照上面几篇文章的方法测试这两个“骨头程序”,可以看到命令行程序和SWT程序同样可以享受到JAVA6带来的Splash