Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » implementing custom widget
implementing custom widget [message #455966] Tue, 24 May 2005 12:34 Go to next message
Andreas Pakulat is currently offline Andreas PakulatFriend
Messages: 127
Registered: July 2009
Senior Member
Hi,

I'm currently trying to port a AWT widget to SWT. It displays a graph
and allows to use the mouse to drag it around... Now trying to map all
the AWT stuff to SWT, I came across following question:

Can SWT widgets use AWT events, i.e. can I still use MouseAdapter from
java.awt.event to implement a MouseListener that corresponds to
mouseEntered and mouseExited? I did not find a SWT MouseListener class
to represent enter and exit Events?

Andreas
Re: implementing custom widget [message #455983 is a reply to message #455966] Tue, 24 May 2005 14:20 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
You can't use AWT listeners for SWT events.

See MouseTrackListener for mouse enter and exit notification.

"Andreas Pakulat" <apaku@gmx.de> wrote in message
news:d6v79c$i54$1@news.eclipse.org...
> Hi,
>
> I'm currently trying to port a AWT widget to SWT. It displays a graph
> and allows to use the mouse to drag it around... Now trying to map all
> the AWT stuff to SWT, I came across following question:
>
> Can SWT widgets use AWT events, i.e. can I still use MouseAdapter from
> java.awt.event to implement a MouseListener that corresponds to
> mouseEntered and mouseExited? I did not find a SWT MouseListener class
> to represent enter and exit Events?
>
> Andreas
Re: implementing custom widget [message #455987 is a reply to message #455966] Tue, 24 May 2005 14:49 Go to previous messageGo to next message
Andreas Pakulat is currently offline Andreas PakulatFriend
Messages: 127
Registered: July 2009
Senior Member
So far I managed to syntactically convert all the code to SWT... The
problem now is: Threading... The widget is heavily using threading and
I'm facing the problem of various things not working from outside the
UI-Thread, i.e. setting of Cursor or just calling redraw....

Is there a way to force a redraw of a Control from outside the UI thread?

Andreas
Re: implementing custom widget [message #456047 is a reply to message #455987] Wed, 25 May 2005 09:48 Go to previous message
Radu is currently offline RaduFriend
Messages: 44
Registered: July 2009
Member
see display.asyncexec or display.syncexec

display.asyncExec(new Runnable() {
public void run() {
//do your stuff here
}
});

most likely this sniped should be inside a method called from outside of
ui thread

Andreas Pakulat wrote:
> So far I managed to syntactically convert all the code to SWT... The
> problem now is: Threading... The widget is heavily using threading and
> I'm facing the problem of various things not working from outside the
> UI-Thread, i.e. setting of Cursor or just calling redraw....
>
> Is there a way to force a redraw of a Control from outside the UI thread?
>
> Andreas
Previous Topic:Tutorial for TreeViewer representing the Filesystem
Next Topic:combo
Goto Forum:
  


Current Time: Thu Apr 25 13:26:18 GMT 2024

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

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

Back to the top