Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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
label.setBackground(SWT.COLOR_GREEN);
communicateWithServer();
label.setBackground(SWT.COLOR_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.setBackground(SWT.COLOR_GREEN);
label.setText(label.getText()); //force repaint
communicateWithServer();
label.setBackground(SWT.COLOR_DARK_BLUE);


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



Back to the top