Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsWhere should I dispose the Image used by Label?
https://www.eclipse.org/forums/index.php/mv/msg/47411/152762/#msg_152762
Originally posted by: wangwei.org.gmail.com
Hi, all!
If I use a image in a Draw2D Label, where should I dispose it?
I tried to override the paintFigure() method like this:
Image image = new Image(...);
label.setIcon(image);
super.paintFigure(g);
image.dispose();
but got an exception:
"java.lang.IllegalArgumentException: Argument not valid"
Thanks!
regards, wangwei]]>2004-10-05T03:52:26-00:00Re: Where should I dispose the Image used by Label?
https://www.eclipse.org/forums/index.php/mv/msg/47411/152905/#msg_152905
Originally posted by: none.us.ibm.com
You should probably keep the image around for the duration of the editor's
existence, or at least as long as the figure exists. Figures are not
disposed, but its editpart is guaranteed to be deactivated, so you can get
rid of the Image at that point. You may want to look into creating a
registry or utility for sharing images across figures/editparts/editors.
"WANG Wei" <wangwei.org@gmail.com> wrote in message
news:cjt5i0$4ic$1@eclipse.org...
> Hi, all!
>
> If I use a image in a Draw2D Label, where should I dispose it?
>
> I tried to override the paintFigure() method like this:
>
> Image image = new Image(...);
> label.setIcon(image);
>
> super.paintFigure(g);
>
> image.dispose();
>
> but got an exception:
> "java.lang.IllegalArgumentException: Argument not valid"
>
> Thanks!
>
> regards, wangwei
>
>]]>2004-10-05T20:56:29-00:00Re: Where should I dispose the Image used by Label?
https://www.eclipse.org/forums/index.php/mv/msg/47411/152989/#msg_152989
Originally posted by: wangwei.org.gmail.com
Thank you!
So I think I could override the function EditPart.deactivate(),
Using a registry is also a good idea, and I have created one.
"Randy Hudson" <none@us.ibm.com> wrote in message
news:cjv1gg$s63$1@eclipse.org...
> You should probably keep the image around for the duration of the editor's
> existence, or at least as long as the figure exists. Figures are not
> disposed, but its editpart is guaranteed to be deactivated, so you can get
> rid of the Image at that point. You may want to look into creating a
> registry or utility for sharing images across figures/editparts/editors.
>
> "WANG Wei" <wangwei.org@gmail.com> wrote in message
> news:cjt5i0$4ic$1@eclipse.org...
> > Hi, all!
> >
> > If I use a image in a Draw2D Label, where should I dispose it?
> >
> > I tried to override the paintFigure() method like this:
> >
> > Image image = new Image(...);
> > label.setIcon(image);
> >
> > super.paintFigure(g);
> >
> > image.dispose();
> >
> > but got an exception:
> > "java.lang.IllegalArgumentException: Argument not valid"
> >
> > Thanks!
> >
> > regards, wangwei
> >
> >
>
>]]>2004-10-06T11:39:31-00:00Re: Where should I dispose the Image used by Label?
https://www.eclipse.org/forums/index.php/mv/msg/47411/153394/#msg_153394
Originally posted by: wkrain.hotmail.com
hi buddy!
i am form china ,i think you too,so can i make friend with you and
commuciation gef with you ?if it is yes,please send mail to me ,i will very
happy.
"WANG Wei" <wangwei.org@gmail.com> д]]>2004-10-09T01:00:06-00:00Re: Where should I dispose the Image used by Label?
https://www.eclipse.org/forums/index.php/mv/msg/47411/153402/#msg_153402
Originally posted by: wkrain.hotmail.com