从Hello, world!开始了解Display和Shell
在这一节中,我们从前面所列举出来的Hello, world!程序开始对swt进行一些初步的探索。所谓的初步是指,我们会介绍编写swt程序的基本思路,以及对两个重要的类:Display和Shell作一些介绍。
因为这一节和前一节是分成两个部分贴出来的,所以我仍然将Hello, world!的代码段在下面列出来:
1
package swtjfacesample;
2
3
import org.eclipse.swt.SWT;
4
import org.eclipse.swt.widgets.Display;
5
import org.eclipse.swt.widgets.Shell;
6
import org.eclipse.swt.widgets.Text;
7
8
public
class
HelloSwt
{
9
/**//**
10
* Hello,world!
11
*
12
* @param args
13
*/
14
public static void main(String[] args)
{
15
Display display = new Display();
16
Shell shell = new Shell(display);
17
18
Text helloText &#

2

3

4

5

6

7

8



9


10

11

12

13

14



15

16

17

18
