Button button = new Button(shell, SWT.PUSH); button.setText("Open Modal Dialog"); button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Button closeButton = new Button(dialogShell, SWT.PUSH); closeButton.setText("Close"); closeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) {
button.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) {
List<Button> buttons = new ArrayList<>(); for (int i = 1; i <= 4; i++) { Button button = new Button(parentComposite, SWT.CHECK); button.setText("Button" + i); button.setSelection(true); button.setEnabled(true); button.addSelectionListener(buttonAdapter); buttons.add(button); }
String text = "btn" + i; Button button = new Button(text); button.addSelectionListener(getCountrySelectionListener(country[i])); buttons[i] = button;
private Button createButton(String text) { Button ret = new Button(parentComposite, SWT.CHECK); ret.setText(text); ret.setSelection(true); ret.setEnabled(true); ret.addSelectionListener(buttonAdapter); }
@Override protected void contributeButtons(final Composite parent) { final Button applyButton = new Button(parent, SWT.PUSH); applyButton.setText("Apply"); final int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); final GridData data = new GridData(SWT.FILL, SWT.CENTER, false, false); final Point minButtonSize = applyButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); data.widthHint = Math.max(widthHint, minButtonSize.x); applyButton.setLayoutData(data); applyButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { performApply(); } }); final GridLayout layout = (GridLayout)parent.getLayout(); layout.numColumns++; }
button.setBounds(-PADDING, -PADDING, CELL_SIZE + 2 * PADDING, CELL_SIZE + 2 * PADDING); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { System.err.println("click on " + number);
button.addSelectionListener(new SelectionAdapter()
btnAdd.addSelectionListener(new SelectionAdapter()
public class MyClass { Label lblStatus; protected void createContents() { shell = new Shell(); shell.setSize(450, 300); shell.setText("SWT Application"); Button btnClickMe = new Button(shell, SWT.NONE); btnClickMe.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent arg0) { lblStatus.setText("Clicked"); // the compiler is aware of lblStatus } }); btnClickMe.setBounds(10, 10, 75, 25); btnClickMe.setText("Click Me"); lblStatus = new Label(shell, SWT.NONE); lblStatus.setBounds(10, 47, 75, 15); lblStatus.setText("Not clicked."); } }
Button button = new Button(shell, SWT.PUSH); button.setText("Click to remove all controls from shell"); button.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent event) {} @Override public void widgetSelected(SelectionEvent event) {
b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { openNewShell(shell);
btn.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent arg0) {
buttonOpen.setText("Open"); buttonOpen.addSelectionListener(new SelectionAdapter() buttonClose.setText("Close"); buttonClose.addSelectionListener(new SelectionAdapter()
button.addSelectionListener(new SelectionListener() {
text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); button.addSelectionListener(new SelectionAdapter()
cb.addSelectionListener(new SelectionAdapter()
Button b = new Button(shell, SWT.PUSH); b.setText("shell "+i); b.addSelectionListener(adapter); b.pack();
b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e)
Button b = new Button(innerComposite, SWT.PUSH); b.setText("Text"); b.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Image image = new Image(display, innerComposite.getBounds().width,