SWT Combo : Combo « SWT JFace Eclipse « Java






SWT Combo

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;

public class Ch5ComboComposite extends Composite {

  public Ch5ComboComposite(Composite parent) {
    super(parent, SWT.NONE);
    buildControls();
  }

  protected void buildControls() {
    setLayout(new RowLayout());

    int[] comboStyles = { SWT.SIMPLE, SWT.DROP_DOWN, SWT.READ_ONLY };

    for (int idxComboStyle = 0; idxComboStyle < comboStyles.length; ++idxComboStyle) {
      Combo combo = new Combo(this, comboStyles[idxComboStyle]);
      combo.add("Option #1");
      combo.add("Option #2");
      combo.add("Option #3");
    }
  }
}

           
       








Related examples in the same category

1.Text and Label demoText and Label demo
2.Sample ComboSample Combo
3.DropDown DemoDropDown Demo
4.demonstrates combos (combobox)demonstrates combos (combobox)
5.Combo (ComboBox) ExampleCombo (ComboBox) Example
6.Combo (ComboBox) Example 2Combo (ComboBox) Example 2
7.Create a combo box (non-editable)Create a combo box (non-editable)