I am trying to draw and animate with SWT using PaintListeners
. I would like to influence the timing of the animation, so I have looked far and wide but could not found anything e开发者_Python百科xplaining where and how the PaintEvents
are generated and how to influence that, e.g enforcing a framerate or sending the PaintEvent only to cetrain Widgets.
So, how can this be done? And, should this be done at all ? - finding nothing on that topic suggests that there may be a better way.
PaintEvents are generated by SWT for you each time it's needed. For example the first time a widget is displayed or after a widget is becoming visible again beacause a window has been moved.
You can force paint event to occur on a Control using:
control.redraw();
control.update();
See here: http://help.eclipse.org/helios/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Control.html#redraw()
精彩评论