Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ve-dev] Re: ve-dev Digest, Vol 31, Issue 3

Hi Evi,

For your example, the display variable is not in scope. VE's templates use Display.getCurrent() when assigning colors, and the background color is settable from the property page, so you don't need to code by hand to set the color.

Please note that this mailing list is for development of the VE. In the future, these kinds of questions should be posted to the newsgroup instead.

Thanks,
Steve Robenalt
Message: 3
Date: Tue, 11 Sep 2007 14:23:03 +0300
From: "evi" <evi@xxxxxxxxxx>
Subject: [ve-dev] Setting colors, SWT lables
To: <ve-dev@xxxxxxxxxxx>
Message-ID: <03cf01c7f466$1e7c69a0$2801a8c0@ws380>
Content-Type: text/plain; charset="us-ascii"

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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://dev.eclipse.org/mailman/listinfo/ve-dev/attachments/20070911/784020bb/attachment.html

------------------------------

_______________________________________________
ve-dev mailing list
ve-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ve-dev


End of ve-dev Digest, Vol 31, Issue 3
*************************************




Back to the top