Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Drawing text on a picture using GC
Drawing text on a picture using GC [message #442810] |
Mon, 13 September 2004 19:34 |
Chris Gross Messages: 471 Registered: July 2009 |
Senior Member |
|
|
I'm trying to draw some text on a picture and its not showing up. I'm sure
I'm just doing something stupid. The code is below. Thanks.
Image leftImage = ResourceManager.getImage(TestComposite.class, "left.gif");
final Label label = new Label(this, SWT.NONE);
GC gc = new GC(leftImage);
Font font = new Font(Display.getCurrent(),"Arial",12,SWT.NONE);
gc.setForeground(new Color(Display.getCurrent(),91,123,176));
gc.drawString("Hello World",1,1,true);
label.setImage(leftImage);
|
|
|
Re: Drawing text on a picture using GC [message #442882 is a reply to message #442810] |
Tue, 14 September 2004 10:16 |
Konstantin Scheglov Messages: 555 Registered: July 2009 |
Senior Member |
|
|
Chris <schtoo@schtoo.com> wrote:
Ha, I know this class - ResourceManager. ;-)
Here is a little changed code that I've used to test.
Notice that main change is gc.dispose().
Image leftImage = ResourceManager.getImage(TestImageLabel.class, "images/left.png");
final Label label = new Label(shell, SWT.NONE);
GC gc = new GC(leftImage);
Font font = new Font(Display.getCurrent(),"Arial",34,SWT.BOLD);
gc.setFont(font);
gc.setForeground(new Color(Display.getCurrent(),91,123,176));
gc.drawString("Hello World",1,1,true);
gc.dispose();
label.setImage(leftImage);
> I'm trying to draw some text on a picture and its not showing up. I'm sure
> I'm just doing something stupid. The code is below. Thanks.
> Image leftImage = ResourceManager.getImage(TestComposite.class, "left.gif");
> final Label label = new Label(this, SWT.NONE);
> GC gc = new GC(leftImage);
> Font font = new Font(Display.getCurrent(),"Arial",12,SWT.NONE);
> gc.setForeground(new Color(Display.getCurrent(),91,123,176));
> gc.drawString("Hello World",1,1,true);
> label.setImage(leftImage);
--
SY, Konstantin.
Advanced Eclipse SWT Designer (http://www.swt-designer.com)
Konstantin Scheglov,
Google, Inc.
|
|
|
Re: Drawing text on a picture using GC [message #442895 is a reply to message #442882] |
Tue, 14 September 2004 18:06 |
Chris Gross Messages: 471 Registered: July 2009 |
Senior Member |
|
|
Hah. Yeah I'm using the SWTDesigner. Thanks for the help.
-Chris
"Konstantin Scheglov" <scheglov_ke@nlmk.ru> wrote in message
news:3cZ63PkmEHA.3588@fairy.ao.nlmk...
> Chris <schtoo@schtoo.com> wrote:
>
> Ha, I know this class - ResourceManager. ;-)
> Here is a little changed code that I've used to test.
> Notice that main change is gc.dispose().
>
> Image leftImage = ResourceManager.getImage(TestImageLabel.class,
> "images/left.png");
> final Label label = new Label(shell, SWT.NONE);
>
> GC gc = new GC(leftImage);
> Font font = new Font(Display.getCurrent(),"Arial",34,SWT.BOLD);
> gc.setFont(font);
>
> gc.setForeground(new Color(Display.getCurrent(),91,123,176));
> gc.drawString("Hello World",1,1,true);
> gc.dispose();
> label.setImage(leftImage);
>
>
>> I'm trying to draw some text on a picture and its not showing up. I'm
>> sure
>> I'm just doing something stupid. The code is below. Thanks.
>
>> Image leftImage = ResourceManager.getImage(TestComposite.class,
>> "left.gif");
>> final Label label = new Label(this, SWT.NONE);
>
>> GC gc = new GC(leftImage);
>> Font font = new Font(Display.getCurrent(),"Arial",12,SWT.NONE);
>
>> gc.setForeground(new Color(Display.getCurrent(),91,123,176));
>> gc.drawString("Hello World",1,1,true);
>> label.setImage(leftImage);
>
>
>
> --
> SY, Konstantin.
> Advanced Eclipse SWT Designer (http://www.swt-designer.com)
|
|
|
Goto Forum:
Current Time: Fri Apr 19 11:21:56 GMT 2024
Powered by FUDForum. Page generated in 0.02008 seconds
|