Draw2D Figures [message #217450] |
Tue, 06 June 2006 12:43 |
Manuel Selva Messages: 189 Registered: July 2009 Location: Grenoble, France |
Senior Member |
|
|
Hi every body,
I have got one question, still about my very large number of draw2D
figures. is it possible, using Draw2D, to reuse an already drawn figure in
an other location into the same parent figure. In other words, is it
possible with only one figure instance into the JVM to draw this figure 2
or more times into my panel??
for example:
myPanel.add(myFigure, new Rectangle(10,10,10,10);
myPanel.add(myFigure, new Rectangle(50,50,10,10);
Thanks
Manu
http://manuelselva.wordpress.com/
|
|
|
|
|
Re: Draw2D Figures [message #217542 is a reply to message #217450] |
Wed, 07 June 2006 18:49 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Yes, you can simply ask a figure to paint on a Graphics. You may have to
translate the graphics to get the desired placement, and most figures
require a parent, which can simply be set to some figure in the diagram.
If you need to alter the figure before it paints, slightly more is involved.
You may have to validate() it.
"Manu" <manuel.selva@st.com> wrote in message
news:15231f7ed6c0334b6701c48cd7f2150c$1@www.eclipse.org...
> Hi every body,
>
> I have got one question, still about my very large number of draw2D
> figures. is it possible, using Draw2D, to reuse an already drawn figure in
> an other location into the same parent figure. In other words, is it
> possible with only one figure instance into the JVM to draw this figure 2
> or more times into my panel??
>
> for example:
>
> myPanel.add(myFigure, new Rectangle(10,10,10,10);
> myPanel.add(myFigure, new Rectangle(50,50,10,10);
>
> Thanks
>
> Manu
>
|
|
|
Re: Draw2D Figures [message #217554 is a reply to message #217450] |
Thu, 08 June 2006 06:30 |
Manuel Selva Messages: 189 Registered: July 2009 Location: Grenoble, France |
Senior Member |
|
|
Thanks every body,
I was just thinking about using the flying pattern to reduce the number of
draw2d figures in my chart. But i think it is impossible to do it using
the classic Draw2D figures wich implements the Figure class. Isn't it ??
Shoul i have to implement my own figures by implementing the IFigure like
Steven said interface or is there an other easier way to do this ??
Thanks.
PS : If someone has already used the flyweight pattern with Draw2D please
can you send me a piece of code wich explain how in more details.
Manu
http://manuelselva.wordpress.com/
|
|
|
Powered by
FUDForum. Page generated in 0.04267 seconds