Example usage for org.eclipse.swt.widgets Composite getLayout

List of usage examples for org.eclipse.swt.widgets Composite getLayout

Introduction

In this page you can find the example usage for org.eclipse.swt.widgets Composite getLayout.

Prototype

public Layout getLayout() 

Source Link

Document

Returns layout which is associated with the receiver, or null if one has not been set.

Usage

From source file:ShowPrefs.java

/**
 * Add buttons/*from   w w  w. ja  va  2s.  c  o  m*/
 * 
 * @param parent the parent composite
 */
protected void contributeButtons(Composite parent) {
    // Add a select all button
    Button selectAll = new Button(parent, SWT.PUSH);
    selectAll.setText("Select All");
    selectAll.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            checkOne.setSelection(true);
            checkTwo.setSelection(true);
            checkThree.setSelection(true);
        }
    });

    // Add a select all button
    Button clearAll = new Button(parent, SWT.PUSH);
    clearAll.setText("Clear All");
    clearAll.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            checkOne.setSelection(false);
            checkTwo.setSelection(false);
            checkThree.setSelection(false);
        }
    });

    // Add two columns to the parent's layout
    ((GridLayout) parent.getLayout()).numColumns += 2;
}