import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class TextTest {
private static Text dingNiDeText_1;
private static Text dingNiDeText;
private static Text text_6;
private static Text text_5;
private static Text text_4;
private static Text text_3;
private static Text text_2;
private static Text text_1;
private static Text text;
/**
* Launch the application
* @param args
*/
public static void main(String[] args) {
final Display display = Display.getDefault();
final Shell shell = new Shell();
shell.setSize(502, 336);
shell.setText("SWT Application");
//
shell.open();
text = new Text(shell, SWT.BORDER);//SWT.BORDER
text.setText("123");
text.setBounds(237, 24, 80, 25);
text_1 = new Text(shell, SWT.CENTER);//居中
text_1.setText("123");
text_1.setBounds(237, 57, 80, 25);
final Label swtNoneLabel = new Label(shell, SWT.NONE);
swtNoneLabel.setText("swt none");
swtNoneLabel.setBounds(74, 27, 48, 12);
final Label label_1 = new Label(shell, SWT.NONE);
label_1.setText("文字样式:居中");
label_1.setBounds(74, 57, 80, 12);
text_2 = new Text(shell, SWT.RIGHT);//右对齐
text_2.setText("123");
text_2.setBounds(237, 88, 80, 25);
text_3 = new Text(shell, SWT.MULTI);
text_3.setText("ding ni de fei fei");//多行 输入 需要回车
text_3.setBounds(237, 119, 80, 25);
text_4 = new Text(shell, SWT.WRAP);//多行 输入 不需要回车
text_4.setText("ding ni de fei fei");
text_4.setBounds(237, 150, 80, 25);
text_5 = new Text(shell, SWT.PASSWORD);//密码
text_5.setText("123");
text_5.setBounds(237, 181, 80, 25);
text_6 = new Text(shell, SWT.READ_ONLY);//只读
text_6.setText("123");
text_6.setBounds(237, 212, 80, 25);
dingNiDeText = new Text(shell,SWT.V_SCROLL);//垂直滚动条
dingNiDeText.setText("ding ni de fei fei");
dingNiDeText.setBounds(237, 236, 80, 25);
dingNiDeText_1 = new Text(shell, SWT.H_SCROLL);//水平滚动条
dingNiDeText_1.setText("ding ni de fei fei");
dingNiDeText_1.setBounds(237, 274, 80, 25);
shell.layout();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}
}
posted on 2008-03-31 07:11
hakuci 阅读(414)
评论(0) 编辑 收藏