Java Code Examples for org.eclipse.swt.widgets.Button.addDisposeListener()

The following are Jave code examples for showing how to use addDisposeListener() of the org.eclipse.swt.widgets.Button class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: n4js   File:   Source Code and License Vote up 5 votes
 * Creates button with {@link org.eclipse.swt.SWT#PUSH} style. Provided parameters control other aspects of the
 * button.
 * @param parent
 *            the parent used to create the button.
 * @param text
 *            the text used to set text of the button.
 * @param listener
 *            the listener added to the button.
 * @param enabled
 *            flag controls if created button is enabled.
 * @return created button.
public static Button createPushButton(final Composite parent, final String text, final SelectionListener listener,
		boolean enabled) {
	final Button button = new Button(parent, PUSH);
	button.setLayoutData(fillDefaults().align(FILL, CENTER).create());
	if (null != listener) {
		button.addDisposeListener(e -> {
	return button;
Example 2
Project: BiglyBT   File:   Source Code and License Vote up 5 votes
public Image setButtonImage(Button btn, final String key) {
	Image bg = getImage(key);
	btn.addDisposeListener(new DisposeListener() {
		public void widgetDisposed(DisposeEvent e) {

	return( bg );