1 | /*
|
---|
2 | * SWT009_01.java
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (c) 2002, 2005 EclipseOS2 Team.
|
---|
7 | * This file is made available under the terms of the Common Public License v1.0
|
---|
8 | * which accompanies this distribution, and is available at
|
---|
9 | * http://www.eclipse.org/legal/cpl-v10.html
|
---|
10 | */
|
---|
11 |
|
---|
12 | import org.eclipse.swt.widgets.Display;
|
---|
13 | import org.eclipse.swt.widgets.Label;
|
---|
14 | import org.eclipse.swt.widgets.Shell;
|
---|
15 | import org.eclipse.swt.SWT;
|
---|
16 | import org.eclipse.swt.widgets.*;
|
---|
17 | import org.eclipse.swt.layout.FillLayout;
|
---|
18 | import org.eclipse.swt.graphics.*;
|
---|
19 |
|
---|
20 | public class SWT009_01 extends SWTTestCase {
|
---|
21 |
|
---|
22 | static {
|
---|
23 | STEP = "009";
|
---|
24 | TEST = "01";
|
---|
25 | DESC = "Label";
|
---|
26 | }
|
---|
27 |
|
---|
28 | Shell createTopShell(Display display) {
|
---|
29 | return new Shell(display, SWT.SHELL_TRIM | SWT.NO_REDRAW_RESIZE);
|
---|
30 | }
|
---|
31 |
|
---|
32 |
|
---|
33 | void initComponents() {
|
---|
34 | shell.setText("Hello World LABEL");
|
---|
35 | shell.setSize(200, 200);
|
---|
36 | Image image = new Image(display, 16, 16);
|
---|
37 | Color color = display.getSystemColor(SWT.COLOR_RED);
|
---|
38 | GC gc = new GC(image);
|
---|
39 | gc.setBackground(color);
|
---|
40 | gc.fillRectangle(image.getBounds());
|
---|
41 | gc.dispose();
|
---|
42 | shell.setLayout(new FillLayout());
|
---|
43 | // Label label = new Label(shell, SWT.WRAP);
|
---|
44 | Label label2 = new Label(shell, SWT.BORDER);
|
---|
45 | label2.setImage(image);
|
---|
46 | // label.setText("Hola Mundo");
|
---|
47 | // Point punto = label.computeSize(SWT.DEFAULT,SWT.DEFAULT);
|
---|
48 | // System.out.println("WIDTH = " + punto.x);
|
---|
49 | // System.out.println("HIGHT = " + punto.y);
|
---|
50 | // label.setAlignment(SWT.RIGHT);
|
---|
51 | // int align = label.getAlignment();
|
---|
52 | // switch(align){
|
---|
53 | // case SWT.RIGHT:{
|
---|
54 | // System.out.println("DERECHA");
|
---|
55 | // break;
|
---|
56 | // }
|
---|
57 | // case SWT.LEFT:{
|
---|
58 | // System.out.println("IZQUIERDA");
|
---|
59 | // break;
|
---|
60 | // }
|
---|
61 | // case SWT.CENTER:{
|
---|
62 | // System.out.println("MITAD");
|
---|
63 | // break;
|
---|
64 | // }
|
---|
65 | // }
|
---|
66 | shell.open();
|
---|
67 | }
|
---|
68 |
|
---|
69 |
|
---|
70 | void setTitle(String title) {
|
---|
71 | super.setTitle(title);
|
---|
72 | }
|
---|
73 |
|
---|
74 | public static void main(String[] args) {
|
---|
75 | go(new SWT009_01());
|
---|
76 | }
|
---|
77 |
|
---|
78 | }
|
---|