954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Swt components created dynamically

Hi all,

I've been searching for some time without any success. Here's the problem: I have an SWT GUI, which contains some UI elements placed onto a Composite. I would like to dynamically add a new Composite to the old one, when a certain event is triggered. Fine everything works just fine, however, the new composite appears only when I resize my window. Tried redrawing the window, not much luck though. Is there any special way to do this?

Thanks,
Chaster

Chaster
Junior Poster in Training
68 posts since Jun 2007
Reputation Points: 12
Solved Threads: 3
 

call pack on the frame in which the component resides

or

call doLayout (and/or validate) on the component to which the component was added and then repaint

Edit: Although, in the second scenario, the layout of the frame itself (if the size of "subcomponent" has changed) will also, still need to be updated, so maybe simply call pack on the Frame or doLayout on the contentPane of the frame.

masijade
Industrious Poster
Moderator
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
 

That did the trick, thank you.

Chaster
call pack on the frame in which the component resides

or

call doLayout (and/or validate) on the component to which the component was added and then repaint

Edit: Although, in the second scenario, the layout of the frame itself (if the size of "subcomponent" has changed) will also, still need to be updated, so maybe simply call pack on the Frame or doLayout on the contentPane of the frame.

Chaster
Junior Poster in Training
68 posts since Jun 2007
Reputation Points: 12
Solved Threads: 3
 

Thanks very much this was very helpful for me too. :)

mostafaelshafei
Newbie Poster
1 post since Jul 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: