|How to get Graphics object in Draw2d? [message #238399]
||Sun, 09 September 2007 22:26
| Hoping White
Registered: July 2009
How can I get a Graphics object in Draw2d System? Like SWT, I can get a
GC object by new GC(Drawable),but how in Draw2d?
I want to get this, becase I want to draw a rectangle centered by mouse
position, and when the mouse moves, the rectangle either. According to my
experince in SWT, draw the rectangle in MouseMotionListener is better, but
this requires GC object, so I want to get Graphics in Draw2d. Or is there
another way to do this in Draw2d?
Thanks very much!
|Re: How to get Graphics object in Draw2d? [message #238420 is a reply to message #238399]
||Mon, 10 September 2007 01:47
Originally posted by: puneet82sri.sify.com|
Can u detail why do u want a rectangle around your mouse pointer.
Hope this helps.
1. You can make use of set cursor on base figure.
2. Gets graphics object
Image img1 = new Image(null, new org.eclipse.swt.graphics.Rectangle(10, 102, 600, 600));
GC gc1 = new GC(img1);
Graphics grap1 = new SWTGraphics(gc1);
Powered by FUDForum
. Page generated in 0.01758 seconds