SWT Label With Text : Label « SWT JFace Eclipse « Java






SWT Label With Text

SWT Label With Text

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

/**
 * @author Steven Holzner
 */
public class LabelWithText {

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



           
       








Related examples in the same category

1.First SWT: LabelFirst SWT: Label
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