• Post Reply Bookmark Topic Watch Topic
  • New Topic

[SWT] Sash (Widget) repaint problem  RSS feed

 
Dennis Meyer
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two trees on the left and right side separated by a sash. On the Sash I paint some lines that will show correlated elements in the trees. The listeners and the painting works well. I Use a GC to Draw on the sash. When my data changes, I will recalculate the line positions and draw on a cleared sash. Therfore I call
1) sash.redraw()
2) render links on the sash

The Problem:
The redraw() will not take place immediatly, but after the painting of my lines - I get an empty Sash!!!

Please help!
Thanks!
 
Dennis Meyer
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a wrong understanding. Use a PaintListener to draw the lines and add it to the Sash. Then every sash.redraw() the PaintListener will also be redrawn. When a different Listener wants to redraw the sash-lines it is best to call sash.redraw() and the loines will also be redrawn. Note that all the lines have to be repaintet every redraw() event.
Have a look at SWT/GC introduction
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!