[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Control.setBackground(Color)

This is a question that should be asked on the newsgroup so that people subscribed to swt-dev don't get spammed.

You can request a repaint by calling redraw(). However, if for some reason you decide to block the UI thread while communicating with a server (as the snippet suggests), then the repaint will not get dispatched until after your code finished executing.  You could force it by calling Control.update().

Why is it called redraw when it generates a PaintEvent?
Why do you drive on a parkway and park in a driveway?

"Erik Poupaert" <erik.poupaert@xxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

02/17/2003 02:24 PM
Please respond to platform-swt-dev

        To:        <platform-swt-dev@xxxxxxxxxxx>
        Subject:        [platform-swt-dev] Control.setBackground(Color)

I've run into something strange with Control.setBackground(Color). I've got
one of these labels that should become green while the application is
communicating with the server, and turn back to blue, when the communication
is over (or red, if there was a problem).

//background is dark blue

Now, the label never becomes green. It simply doesn't get executed. When I
change the text of the label, however, it does get executed. So, now I've
got the following strange workaround:

//background is dark blue
label.setText(label.getText()); //force repaint

Is there any other, more appropriate, way to force a repaint?

platform-swt-dev mailing list