Mega Code Archive

 
Categories / Java Tutorial / SWT
 

Label with border

import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; public class BorderLabelExample {   public static void main(String[] args) {     Display display = new Display();     Shell shell = new Shell();     shell.setLayout(new GridLayout(1, false));     // Create a label with a border     new Label(shell, SWT.BORDER).setText("This is a label with a border.");     shell.open();     while (!shell.isDisposed()) {       if (!display.readAndDispatch()) {         display.sleep();       }     }     display.dispose();   } }