List of usage examples for org.eclipse.swt.widgets Label setBounds
public void setBounds(Rectangle bounds)
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 a 2s.co m*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:LabelWithText.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setSize(300, 200);/* www . j a v a 2s . c o m*/ 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);/*ww w. j a v 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:org.eclipse.swt.examples.helloworld.HelloWorld2.java
public Shell open(Display display) { Shell shell = new Shell(display); Label label = new Label(shell, SWT.CENTER); label.setText(resHello.getString("Hello_world")); label.setBounds(shell.getClientArea()); shell.open();//from ww w.ja va 2 s.c o m return shell; }
From source file:org.eclipse.swt.examples.helloworld.HelloWorld3.java
public Shell open(Display display) { final Shell shell = new Shell(display); final Label label = new Label(shell, SWT.CENTER); label.setText(resHello.getString("Hello_world")); label.pack();//from ww w .j a v a2s . c o m shell.addControlListener( ControlListener.controlResizedAdapter(e -> label.setBounds(shell.getClientArea()))); shell.pack(); shell.open(); return shell; }
From source file:HelloWorld3.java
public Shell open(Display display) { final Shell shell = new Shell(display); final Label label = new Label(shell, SWT.CENTER); label.setText("Hello_world"); label.pack();/*w ww . j a va2s . c o m*/ shell.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { label.setBounds(shell.getClientArea()); } }); shell.pack(); shell.open(); return shell; }