Skip to main content



      Home
Home » Eclipse Projects » JFace » JFace close button(Proper technique)
JFace close button [message #777694] Tue, 10 January 2012 17:32 Go to next message
Eclipse UserFriend
I created a JFace application containing a "Close" button. In the "mouseUp" event, I placed:

Display.getCurrent().dispose();

I modified main() thusly:

if(Display.getCurrent() != null) {
Display.getCurrent().dispose();
}

Is this a reasonable way to code a JFace close application from a button? What is the preferred method of accomplishing this?

Thanx,
Bill
Re: JFace close button [message #778182 is a reply to message #777694] Wed, 11 January 2012 09:34 Go to previous message
Eclipse UserFriend
On 2012-01-10 23:32, Bill Brandley wrote:
> I created a JFace application containing a "Close" button. In the
> "mouseUp" event, I placed:
>
> Display.getCurrent().dispose();
>
> I modified main() thusly:
>
> if(Display.getCurrent() != null) {
> Display.getCurrent().dispose();
> }
>
> Is this a reasonable way to code a JFace close application from a
> button? What is the preferred method of accomplishing this?

I would instead call the "close" function from the shell:

"* Requests that the window manager close the receiver in
* the same way it would be closed when the user clicks on
* the "close box" or performs some other platform specific
* key or mouse combination that indicates the window
* should be removed."

This seems to be the more appropriate action to me. Display.close is
more drastically and does not give corresponding promises. It should be
invoked after the disposal of the shell, though.

HTH & Greetings from Bremen,

Daniel Krügler
Previous Topic:Question about ImageDescriptor
Next Topic:[databinding] Whats is the minimum to bind a custom model
Goto Forum:
  


Current Time: Fri Jul 11 21:24:21 EDT 2025

Powered by FUDForum. Page generated in 0.24938 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top