[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools] Re: Set image and background on Label
|
This appears to be a bug and we are investigating.
In the meantime a work around for getting the background back is to set
the text to an empty string as shown in this example:
public static void main(String[] args) {
Display display = new Display();
final Image image = new Image(display, _Scrapbook.class.getResourceAsStream ("navigator.bmp"));
Shell shell = new Shell(display);
final Label label = new Label(shell, SWT.BORDER);
label.setBounds(10, 10, 200, 50);
label.setBackground(display.getSystemColor(SWT.COLOR_RED));
Button b = new Button(shell, SWT.PUSH);
b.setText("clear image");
b.setBounds(10, 80, 100, 50);
b.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
label.setText("");
}
});
b = new Button(shell, SWT.PUSH);
b.setText("set image");
b.setBounds(120, 80, 100, 50);
b.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
label.setImage(image);
}
});
shell.open();
while (shell != null && !shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
image.dispose();
}