Status: New
Owner: ----
Labels: Type-Enhancement Priority-Medium Effort-Medium OpSys-All  
Toolkit-Piccolo2D.Java

New issue 124 by heuermh: Add additional constructors to PSWTImage
http://code.google.com/p/piccolo2d/issues/detail?id=124

Old post to piccolo-dev, referred to in Issue 43.

From: Fabio Zadrozny
Date: Thu Apr 13 10:12:12 EDT 2006

  Sure, thanks... And while we are at it, there is another 'dispose' related
thing I wanted to request... It's not a bug, but a feature-request I find
important... I'm doing an Eclipse plugin, and I manage all the Images and
dispose them carefully (and share it among lot's of objects), so, I've added
the following constructors to PSWTImage, which I think should be in the
'default' distribution, as I think that's pretty common when using SWT
(sharing an image through several objects).

Thanks,

Fabio


CODE: PSWTImage.java--------------------------------------------------------

     public PSWTImage(PSWTCanvas canvas) {
         this(canvas, true);
     }

     public PSWTImage(PSWTCanvas canvas, final boolean disposeImage) {
         super();

         this.canvas         canvas.addDisposeListener(new DisposeListener()  
{
             public void widgetDisposed(DisposeEvent de) {
                 if (image !                    image.dispose();
                 }
             }
         });
     }

     public PSWTImage(PSWTCanvas canvas, Image newImage) {
         this(canvas, newImage, true);
     }

     public PSWTImage(PSWTCanvas canvas, Image newImage, boolean
disposeImage) {
         this(canvas, disposeImage);
         setImage(newImage);
     }

     public PSWTImage(PSWTCanvas canvas, String fileName) {
         this(canvas, fileName, true);
     }

     public PSWTImage(PSWTCanvas canvas, String fileName, boolean
disposeImage) {
         this(canvas, disposeImage);
         setImage(fileName);
     }


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to