Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I am not really sure if you have a problem with the enabling / disabling of the buttons, or putting the delay in between the execution flow.</p> <p>I have modified Jared's code above to perform both these operations mentioned. Please have a look at this and let me know if this what you were looking for. </p> <p>Cheers. :-)</p> <pre><code>import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; 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.Shell; public class app1 { public static void main(final String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new GridLayout(3, false)); final Button button1 = new Button(shell, SWT.PUSH); button1.setText("Click"); final Button button2 = new Button(shell, SWT.PUSH); button2.setText("Me"); final Button button3 = new Button(shell, SWT.PUSH); button3.setText("Dude"); button1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); button2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); button3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false)); button2.setEnabled(false); button3.setEnabled(false); button1.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { button1.setEnabled(false); button2.setEnabled(true); button3.setEnabled(true); new Runnable() { public void run() { try { // Do your operation here. // // Dummy sleep performed here instead. Thread.sleep(1000); } catch (InterruptedException e1) { e1.printStackTrace(); } } }.run(); button1.setEnabled(true); button2.setEnabled(false); button3.setEnabled(false); } }); shell.open(); shell.pack(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload