[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [ve-dev] Setting colors, SWT lables
|
Evi:
What about using something like:
label.setBackground(new Color(Display.getDefault(),200,111,50));
Or keeping a tab on a dislpay in a variable?
--
Cheers
Philippe
-----Original Message-----
From: ve-dev-bounces@xxxxxxxxxxx [mailto:ve-dev-bounces@xxxxxxxxxxx] On
Behalf Of evi
Sent: Tuesday, September 11, 2007 4:23 AM
To: ve-dev@xxxxxxxxxxx
Subject: [ve-dev] Setting colors, SWT lables
Hello!
I have tried to figure out how to set label background colors when
working with Eclipse SWT. The only advise I found was to use
"label.setBackground(new Color(display,200,111,50));
But in automatically created VE+SWT construct "display" is not
recognised. My code is copied below, please advise what I need to change
in order to set background colors to widgets.
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.*;
public class StartWindow {
private Shell sShell = null;
private Label label = null;
public static void main(String[] args) {
Display display = Display.getDefault();
StartWindow thisClass = new StartWindow();
thisClass.createSShell();
thisClass.sShell.open();
while (!thisClass.sShell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
/**
* This method initializes sShell
*/
private void createSShell() {
sShell = new Shell();
sShell.setText("Shell");
sShell.setSize(new Point(300, 200));
sShell.setLayout(new GridLayout());
label = new Label(sShell, SWT.NONE);
label.setText("labellabellabel");
label.setBackground(new Color(display,200,111,50));
}
}
Regards,
Evi