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

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.

Edited 6 Years Ago by masijade: n/a

Comments
Short, very good answer, that solves the issue.

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.

This question has already been answered. Start a new discussion instead.