Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] SWT program

Hi,can someone tell me why my code marked red below doesn't work?
 
 
 
public class LayoutDataTest {
 
   public static void main(String[] args) {
 
       Display display = new Display();
 
       Shell shell = new Shell(display);
 
       // Create the layout.
 
       GridLayout layout = new GridLayout();
      
       // Optionally set layout fields.
 
       // Set the layout into the composite.
 
       shell.setLayout(layout);
 
       // Create the children of the composite.
 
       Button button1 = new Button(shell, SWT.PUSH);
       button1.setText("Button1");
       button1.setSize(30,10);
 
       shell.pack();
 
       shell.open();
 
       while (!shell.isDisposed()) {
 
          if (!display.readAndDispatch()) display.sleep();
 
       }
 
   }
 
}
 
 
 
Thanks,
 
kian

 


Back to the top