Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] A problem about widget redraw after disposal


Hi all,
I encounter a problem in SWT programming.
In a composite, for example, a Group, I add a Button:

        Shell shell = new Shell(new Display());
        shell.setLayout(new FillLayout(SWT.VERTICAL));
        Group group = new Group(shell, SWT.SHADOW_IN);
        group.setLayout(new RowLayout(SWT.VERTICAL));
        Button b = new Button(group, SWT.BORDER);
        b.setText("1");
        shell.open();

Then, I call b's dispose() method:
        b.dispose();

Then, create a new Button in group:
        b = new Button(group, SWT.BORDER);
        b.setText("2");

But now I see nothing in the view of the group. Only when I resize the window, does the second button appear.
My problem is: How to let the second button appear without having to resize the window?
I have tried shell.redraw();shell.update() and group.redraw();group.update(),
but they don't work.

Thanks in advance!

Best regards,
-----------------------
Rafael ZHANG
GCL(Globalization Certification Laboratory), CSDL(China Software Development Lab), IBM China
10/F, Shui On Plaza, 333 Middle Huai Hai Road, Shanghai 200021, P.R.China
TEL: (8621)63262288-5846
FAX: (8621)63261177
E-mail: gclprjg@xxxxxxxxxx

Back to the top