Layout Components : Layout « SWT JFace Eclipse « Java

Java
1. 2D Graphics GUI
2. 3D
3. Advanced Graphics
4. Ant
5. Apache Common
6. Chart
7. Class
8. Collections Data Structure
9. Data Type
10. Database SQL JDBC
11. Design Pattern
12. Development Class
13. EJB3
14. Email
15. Event
16. File Input Output
17. Game
18. Generics
19. GWT
20. Hibernate
21. I18N
22. J2EE
23. J2ME
24. JDK 6
25. JNDI LDAP
26. JPA
27. JSP
28. JSTL
29. Language Basics
30. Network Protocol
31. PDF RTF
32. Reflection
33. Regular Expressions
34. Scripting
35. Security
36. Servlets
37. Spring
38. Swing Components
39. Swing JFC
40. SWT JFace Eclipse
41. Threads
42. Tiny Application
43. Velocity
44. Web Services SOA
45. XML
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java » SWT JFace Eclipse » LayoutScreenshots 
Layout Components
Layout Components


/******************************************************************************
 * Copyright (c) 1998, 2004 Jackwind Li Guojie
 * All right reserved. 
 
 * Created on Jan 27, 2004 11:50:44 PM by JACK
 * $Id$
 
 * visit: http://www.asprise.com/swt
 *****************************************************************************/



import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class Layouting {

  Display display = new Display();
  Shell shell = new Shell(display);
  
  int count = 0;

  public Layouting() {
    init();
    shell.setLayout(new RowLayout());
    
    final Composite composite = new Composite(shell, SWT.BORDER);
    composite.setLayout(new RowLayout());
    composite.setBackground(display.getSystemColor(SWT.COLOR_YELLOW));
    composite.addControlListener(new ControlListener() {
      public void controlMoved(ControlEvent e) {
        // TODO Auto-generated method stub

      }

      public void controlResized(ControlEvent e) {
        System.out.println("Composite resize.");
      }
    });
    
    Button buttonAdd = new Button(shell, SWT.PUSH);
    buttonAdd.setText("Add new button");
    buttonAdd.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        Button button = new Button(composite, SWT.PUSH);
        button.setText("Button #" (count++));
        //composite.layout(true);
        composite.pack();
        //shell.layout(true;
        // shell.pack(true);
      }
    });
    
  
    // shell.pack();
    shell.setSize(450100);
    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 Layouting();
  }
}


           
       
Related examples in the same category
1. SWT Layout Example in OneSWT Layout Example in One
2. SWT GridLayout DemoSWT GridLayout Demo
3. SWT GridLayoutSWT GridLayout
4. Control Size LocationControl Size Location
5. SWT RowLayout SampleSWT RowLayout Sample
6. SWT FillLayout SampleSWT FillLayout Sample
7. SWT Form Layout SampleSWT Form Layout Sample
8. SWT GridLayout SampleSWT GridLayout Sample
9. GridLayout Sample Grab SpaceGridLayout Sample Grab Space
10. Grid Layout SpanGrid Layout Span
11. Layout TermsLayout Terms
12. StackLayout SampleStackLayout Sample
13. BorderLayout SampleBorderLayout Sample
14. FormLayoutsFormLayouts
15. FormLayout SimpleFormLayout Simple
16. A BorderLayoutA BorderLayout
17. FillLayout HorizontalFillLayout Horizontal
18. FillLayout VerticalFillLayout Vertical
19. FormLayout ComplexFormLayout Complex
20. FormLayout Form AttachmentFormLayout Form Attachment
21. FormLayoutFormLayout
22. GridLayout 2x2GridLayout 2x2
23. Grid Layout ComplexGrid Layout Complex
24. No LayoutNo Layout
25. Row Layout TestRow Layout Test
26. Stack Layout TestStack Layout Test
27. Row Layout HorizontalRow Layout Horizontal
28. FillLayout ExampleFillLayout Example
29. FormLayout ExampleFormLayout Example
30. GridLayout ExampleGridLayout Example
31. GridLayout Example 2GridLayout Example 2
32. Layout ExampleLayout Example
33. RowLayout ExampleRowLayout Example
34. SWT FillLayout
35. SWY Radial Layout
36. Use of Radial Layout
37. GridLayout with All Options
38. Simplest GridLayout
39. SWT GridLayout: GridSpan
40. SWT RowLayout
41. SWT FillLayout Composite
42. SWT GridLayout: align widgets in a vertical columnSWT GridLayout: align widgets in a vertical column
43. SWT GridLayout: align widgets in a horizontal rowSWT GridLayout: align widgets in a horizontal row
44. Exclude a widget from a GridLayoutExclude a widget from a GridLayout
45. Insert widgets into a grid layoutInsert widgets into a grid layout
46. Align widgets in a GridLayoutAlign widgets in a GridLayout
47. FormLayout: create a simple OK and CANCEL dialog using form layoutFormLayout: create a simple OK and CANCEL dialog using form layout
48. FormLayout: center a label and single line text using a form layoutFormLayout: center a label and single line text using a form layout
49. FormLayout: create a simple dialog using form layoutFormLayout: create a simple dialog using form layout
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.