import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.custom.CLabel;
public class BB{
public static void main(String[] args){
//自定义标签——创建一个带有图标和文字的标签
Display display=new Display();
Shell shell=new Shell(display);
shell.setText("i am a shell");
shell.setSize(400,400);
shell.setLayout(new FillLayout(SWT.VERTICAL));//必须要有
//shell.setLayout(new FillLayout(SWT.HORIZONTAL));//必须要有
Label label=new Label(shell,SWT.LEFT);
label.setText("这是一个文字标签Label");
CLabel clabel=new CLabel(shell,SWT.LEFT);
clabel.setText("这是自定义的文字标签CLabel");
CLabel clabel2=new CLabel(shell,SWT.LEFT);
clabel2.setText("这是自定义的文字带图标的标签CLabel");
clabel2.setImage(display.getSystemImage(SWT.ICON_INFORMATION));
//打开窗口,进行窗口的显示
shell.open();
while(!shell.isDisposed()){
//当窗口没有被释放的时候
if(!display.readAndDispatch()){
display.sleep();
}
}
display.dispose();
}
}