Source Code : Grid Layout Span

Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com. Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com. Click Here or search from google with Libraries Name you get jar file related it

Grid Layout Span

Grid Layout Span

// -Djava.library.path=D:Java_Deveclipsepluginsorg.eclipse.swt.win32_3.0.0oswin32x86

/******************************************************************************
 * Copyright (c) 1998, 2004 Jackwind Li Guojie
 * All right reserved. 
 * 
 * Created on Jan 29, 2004 10:12:41 AM by JACK
 * $Id$
 * 
 * visit: http://www.asprise.com/swt
 *****************************************************************************/

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell;

public class GridLayoutSampleSpan {
  Display display = new Display();
  Shell shell = new Shell(display);

  public GridLayoutSampleSpan() {
    
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    gridLayout.makeColumnsEqualWidth = true;
    
    shell.setLayout(gridLayout);

    Button button1 = new Button(shell, SWT.PUSH);
    button1.setText("button1");
    button1.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    
    List list = new List(shell, SWT.BORDER);
    list.add("item 1");
    list.add("item 2");
    list.add("item 3");
    list.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER));
    
    Button button2 = new Button(shell, SWT.PUSH);
    button2.setText("button #2");  
    GridData gridData = new GridData(GridData.VERTICAL_ALIGN_END);
    gridData.horizontalSpan = 2;
    gridData.horizontalAlignment = GridData.FILL;
    button2.setLayoutData(gridData);
    
    Button button3 = new Button(shell, SWT.PUSH);
    button3.setText("3");
    GridData gridData2 = new GridData(GridData.VERTICAL_ALIGN_END);
    gridData2.verticalSpan = 3;
    button3.setLayoutData(gridData2);
    
    
    shell.pack();
    shell.open();
    //textUser.forceFocus();

    // Set up the event loop.
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        // If no more entries in event queue
        display.sleep();
      }
    }

    display.dispose();
  }

  private void init() {

  }

  public static void main(String[] args) {
    new GridLayoutSampleSpan();
  }
}


           
       

Thank with us