Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Where should I dispose the Image used by Label?
Where should I dispose the Image used by Label? [message #152762] Tue, 05 October 2004 03:52 Go to next message
Eclipse UserFriend
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
Re: Where should I dispose the Image used by Label? [message #152905 is a reply to message #152762] Tue, 05 October 2004 20:56 Go to previous messageGo to next message
Eclipse UserFriend
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
>
>
Re: Where should I dispose the Image used by Label? [message #152989 is a reply to message #152905] Wed, 06 October 2004 11:39 Go to previous messageGo to next message
Eclipse UserFriend
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
> >
> >
>
>
Re: Where should I dispose the Image used by Label? [message #153394 is a reply to message #152989] Sat, 09 October 2004 01:00 Go to previous messageGo to next message
Eclipse UserFriend
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> д
Re: Where should I dispose the Image used by Label? [message #153402 is a reply to message #152762] Sat, 09 October 2004 01:19 Go to previous message
Eclipse UserFriend
Originally posted by: wkrain.hotmail.com

"WANG Wei" <wangwei.org@gmail.com> д
Previous Topic:Transparent, scalable figures
Next Topic:a boolean and file property type
Goto Forum:
  


Current Time: Fri Apr 19 09:37:39 GMT 2024

Powered by FUDForum. Page generated in 0.02118 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top