First SWT: Label : Label « SWT JFace Eclipse « Java






First SWT: Label

First SWT: Label

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class FirstSWTClass {

  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("First SWT Application");
    shell.setSize(250, 250);
    Label label = new Label(shell, SWT.CENTER);
    label.setText("Greetings from SWT");
    label.setBounds(shell.getClientArea());
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    display.dispose();
  }
}



           
       








Related examples in the same category

1.SWT Label With TextSWT Label With Text
2.Label Highlighting 3Label Highlighting 3
3.Label HighlightingLabel Highlighting
4.Label Highlighting 2Label Highlighting 2
5.CLabel BorderCLabel Border
6.CLabel Gradient Background CLabel Gradient Background
7.Label SeparatorLabel Separator
8.Label WrapLabel Wrap
9.Text and Label demoText and Label demo
10.Formatted TextFormatted Text
11.Demonstrates LabelsDemonstrates Labels
12.Demonstrates CLabel gradientsDemonstrates CLabel gradients
13.Demonstrates CLabel 2Demonstrates CLabel 2
14.Demonstrates CLabelDemonstrates CLabel
15.Create a label (a separator)Create a label (a separator)
16.Create a label (with an image)Create a label (with an image)
17.how to resize the Label when the Shell resizes using a Listener mechanismhow to resize the Label when the Shell resizes using a Listener mechanism
18.How to resize the Label when the Shell resizes using a LayoutHow to resize the Label when the Shell resizes using a Layout