List of usage examples for org.eclipse.swt.widgets Label Label
public Label(Composite parent, int style)
From source file:MainClass.java
public static void main(String[] a) { Display display = new Display(); Shell shell = new Shell(display); Label label = new Label(shell, SWT.CENTER); label.setText("Hello, World"); label.setBounds(shell.getClientArea()); shell.open();//from w w w .j av a2 s .co m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:WidgetStyle.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Label label = new Label(shell, SWT.SHADOW_IN | SWT.CENTER); shell.setLayout(new GridLayout()); if ((label.getStyle() & SWT.CENTER) != 1) { System.out.println("center"); } else {//ww w. j a v a2 s . c o m System.out.println("not center"); } shell.setSize(260, 120); shell.open(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:LabelWithText.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setSize(300, 200);//from www .j av a2 s .c om 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(); }
From source file:FirstSWTClass.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("First SWT Application"); shell.setSize(250, 250);/*from w ww . j av a 2 s . c o m*/ 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(); }
From source file:SeparatorHorizontalVertical.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL); new Label(shell, SWT.SEPARATOR | SWT.VERTICAL); shell.setSize(200, 200);//ww w . j a v a 2 s . com shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:WrapStyleLabel.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); String text = "This is a long long long long long long long text."; Label labelNoWrap = new Label(shell, SWT.BORDER); labelNoWrap.setText(text);// w w w . j av a 2 s.co m labelNoWrap.setBounds(10, 10, 100, 100); Label labelWrap = new Label(shell, SWT.WRAP | SWT.BORDER); labelWrap.setText(text); labelWrap.setBounds(120, 10, 100, 100); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:PlainLabelExample.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(); shell.setLayout(new GridLayout(1, false)); // Create a label new Label(shell, SWT.NONE).setText("This is a plain label."); shell.open();/*from w w w.j av a2s . c o m*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:LabelWithBorder.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new RowLayout()); Label label = new Label(shell, SWT.BORDER); label.setText("text on the label"); shell.open();/*from w w w . j a v a 2s .c o m*/ // Set up the event loop. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { // If no more entries in event queue display.sleep(); } } display.dispose(); }
From source file:SeparatorLabelExample.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(); shell.setLayout(new GridLayout(1, false)); // Create a vertical separator new Label(shell, SWT.SEPARATOR); shell.open();/*from w w w .j a v a 2 s. c o m*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:SystemIconImage.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new RowLayout()); Label label = new Label(shell, SWT.NONE); label.setImage(display.getSystemImage(SWT.ICON_ERROR)); label = new Label(shell, SWT.NONE); label.setText("SWT.ICON_ERROR"); label = new Label(shell, SWT.NONE); label.setImage(display.getSystemImage(SWT.ICON_INFORMATION)); label = new Label(shell, SWT.NONE); label.setText("SWT.ICON_INFORMATION"); label = new Label(shell, SWT.NONE); label.setImage(display.getSystemImage(SWT.ICON_WARNING)); label = new Label(shell, SWT.NONE); label.setText("SWT.ICON_WARNING"); label = new Label(shell, SWT.NONE); label.setImage(display.getSystemImage(SWT.ICON_QUESTION)); label = new Label(shell, SWT.NONE); label.setText("SWT.ICON_QUESTION"); shell.setSize(400, 350);// w ww.ja v a 2 s. c o m shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }