Control클래스의 하위 클래스...
가장 간단하다. 정적 정보를 GUI에 표시한다. 문자열, Image 등이 여기속하며 사용자 입력은 받지 못한다.
빈번하게 사용하므로 잘 알아둘 필요가 있다.

Label - 생성자
public Label(Composite parent, int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.

Parameters:
parent - a composite control which will be the parent of the new instance (cannot be null)
style - the style of control to construct
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the parent is null
SWTException -
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
See Also:
SWT.SEPARATOR, SWT.HORIZONTAL, SWT.VERTICAL, SWT.SHADOW_IN, SWT.SHADOW_OUT, SWT.SHADOW_NONE, SWT.CENTER, SWT.LEFT, SWT.RIGHT, SWT.WRAP, Widget.checkSubclass(), Widget.getStyle()
//사용예 코드
protected Control createContents(Composite parent){ //오버라이딩
  getShell().setText("widget window");

  Label slabel = new Label(parent,SWT.CENTER);
  slabel.setText("레이블테스트");
  slabel.setBounds(30, 60, 110, 15);
  Label ssep = new Label(parent, SWT.SEPARATOR | SWT.SHADOW_OUT);
  ssep.setBounds(30, 85, 110, 5);

  
  parent.pack(); //위젯을 선호하는 크기로 조정. 내용물에 따라 컨테이너크기 자동 조정
  return parent;
 }
AND