[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: No JavaBeans support!?: [platform-swt-dev] java.awt.Image
|
Hello Mike.
Actually I was not complaining about SWT but about beans in general. I have thousands of non-visual beans and I cannot use them with SWT right now, cause VM crashes due to motif linkage problem.
As concern SWT design - I understand the advantage of specifying hierarchy in constructor - it is the only method that can be called just once - one does not need to worry about hierarchy being change later and everything is simpler...
As concern JavaBeans spec - did you do something to change it (www.jsp.org)? I expect IBM to have big respect there. Btw. you can get around constructor problems using BeanContext - but that is not the favourite part of beans spec...
jst
-----Original Message-----
From: "Mike Wilson/OTT/OTI" <Mike_Wilson@xxxxxxx>
Date: Wed, 28 Nov 2001 09:25:07 -0500
To: platform-swt-dev@xxxxxxxxxxx
Subject: Re: No JavaBeans support!?: [platform-swt-dev] java.awt.Image
> I just finished writing a FAQ entry about java beans:
>
> "
> Will or can SWT be enhanced to include support for JavaBeans?
>
> To the extent that it makes sense, given the constraints of operating
> system compatibility, SWT already mirrors the beans behavior. An example
> of this is the use of standard beans mechanisms for event dispatch
> (EventListener, EventObject and adapter classes). Some aspects of the
> beans paradigm, such as the ability to create beans with null
> constructors, run counter to the constraints of the underlying operating
> systems that SWT runs on. For example, operating systems do not typically
> support creating a widget without specifying its parent.
> "
>
> The essence of the problem is, if you allow a widget to be created with a
> null constructor, then you can't actually create the o/s resources at the
> time the constructor runs (you would have to wait until later, after the
> parent has been set). We just can not do this, since we *always* create
> the o/s resources in the constructor, and for
> performance/efficiency/consistancy reasons do not even keep slots in the
> object to hold whatever state would be required so that the object *could*
> be created later.
>
> SWT widgets are not beans and will not become beans until the beans spec
> gets fixed.
>
> McQ.
>
>
>
>
>
> "Jess Terr" <jst@xxxxxxxxxxxxx>
> Sent by: platform-swt-dev-admin@xxxxxxxxxxx
> 11/28/2001 02:56 AM
> Please respond to platform-swt-dev
>
>
> To: platform-swt-dev@xxxxxxxxxxx
> cc:
> Subject: No JavaBeans support!?: [platform-swt-dev] java.awt.Image
>
> Thank you for clarification - but this means that under java2 and eclipse
> on linux I cannot use classes written according to JavaBeans
> specification!
>
> Will there be an efford to fix it or such feature will be available just
> for windows?
>
> For me this is a blocker - I love javabeans and I want to write more than
> one platform applications - I guess I should now relax for a while and
> wait if things get better over time.
>
> Thank you both for all your answers.
> jst
>
>
> -----Original Message-----
> From: "Silenio Quarti/OTT/OTI" <Silenio_Quarti@xxxxxxx>
> Date: Tue, 27 Nov 2001 11:24:45 -0500
> To: platform-swt-dev@xxxxxxxxxxx
> Subject: Re: [platform-swt-dev] java.awt.Image
>
>
> > Hi Jeff,
> >
> > This is a known problem. You will not be able to mix AWT and SWT
> > widgets/components on Motif/Linux due to a linkage problem. Basically,
> > the AWT library is linked to a different Motif library than SWT is. This
> > causes conflicts which result in a GPF.
> >
> > Silenio
> >
> >
> >
> >
> >
> > "Jess Terr" <jst@xxxxxxxxxxxxx>
> > Sent by: platform-swt-dev-admin@xxxxxxxxxxx
> > 11/27/01 02:41 AM
> > Please respond to platform-swt-dev
> >
> >
> > To: platform-swt-dev@xxxxxxxxxxx
> > cc:
> > Subject: Re: [platform-swt-dev] java.awt.Image
> >
> > Thanks for reply Silenio.
> > I have tried your suggestion, but my VM crashes. I tried to submit a bug
>
> > to bugzilla, but I cannot login because of invalid password (the one I
> > received contains space, maybe that is the problem - if somebody can fix
>
> > it I'll be glad).
> >
> > So here is my bug report, see attached ZIP for demonstation case and log
>
> > file for error I received.
> >
> > I am running Linux, sun's jdk1.3.1_01
> >
> > Regards.
> > jst
> >
> >
> >
> > -----Original Message-----
> > From: "Silenio Quarti/OTT/OTI" <Silenio_Quarti@xxxxxxx>
> > Date: Mon, 26 Nov 2001 16:40:20 -0500
> > To: platform-swt-dev@xxxxxxxxxxx
> > Subject: Re: [platform-swt-dev] java.awt.Image
> >
> >
> > > I believe the only possible way of doing what you want is by
> > > getting the data out of the AWT image and create a SWT image
> > > using that data.
> > >
> > > The code below shows how to do this. Keep in that the following
> > > code does not handle all images properly. For e
> > >
> > >
> > > import java.awt.Frame;
> > > import java.awt.MediaTracker;
> > > import java.awt.Toolkit;
> > > import java.awt.image.*;
> > > import org.eclipse.swt.*;
> > > import org.eclipse.swt.widgets.*;
> > > import org.eclipse.swt.graphics.*;
> > >
> > > public class AWTToSWTImage {
> > >
> > > public static void main(String[] args) throws Exception {
> > > Frame frame = new Frame();
> > >
> > > java.awt.Image awtImage =
> > Toolkit.getDefaultToolkit().getImage("c:\\temp\\upgray.gif");
> > > MediaTracker tracker = new MediaTracker(frame);
> > > tracker.addImage(awtImage, 0);
> > > tracker.waitForAll();
> > >
> > > int width = awtImage.getWidth(null);
> > > int height = awtImage.getHeight(null);
> > > PixelGrabber grabber = new PixelGrabber(awtImage, 0, 0, width,
>
> > height, true);
> > >
> > > if (!grabber.grabPixels()) {
> > > System.out.println("Error");
> > > return;
> > > }
> > >
> > > DirectColorModel cm =
> > > (DirectColorModel)ColorModel.getRGBdefault();
> > > int[] pixels = (int[])grabber.getPixels();
> > >
> > > PaletteData palette = new PaletteData(cm.getRedMask(),
> > cm.getGreenMask(), cm.getBlueMask());
> > > ImageData data = new ImageData(width, height,
> cm.getPixelSize(),
> > palette);
> > > data.setPixels(0, 0, width * height, pixels, 0);
> > >
> > > Display display = new Display();
> > > Shell shell = new Shell();
> > > final Image swtImage = new Image(display, data);
> > > shell.addListener(SWT.Paint, new Listener() {
> > > public void handleEvent(Event e) {
> > > GC gc = e.gc;
> > > gc.drawImage(swtImage, 10, 10);
> > > }
> > > });
> > > shell.setBounds(0, 0, 300, 300);
> > > shell.open();
> > >
> > > while (!shell.isDisposed()) {
> > > if (!display.readAndDispatch()) display.sleep();
> > > }
> > > }
> > >
> > > }
> > >
> > >
> > >
> > >
> > >
> > >
> > > "Jess Terr" <jst@xxxxxxxxxxxxx>
> > > Sent by: platform-swt-dev-admin@xxxxxxxxxxx
> > > 11/26/01 11:03 AM
> > > Please respond to platform-swt-dev
> > >
> > >
> > > To: platform-swt-dev@xxxxxxxxxxx
> > > cc:
> > > Subject: [platform-swt-dev] java.awt.Image
> > >
> > > Hello.
> > > I have tried to port my old AWT application to SWT and everything
> seemed
> >
> > > fine until I realized that AWT Image is not SWT Image.
> > >
> > > That also would not be problem, if I was in control of creation of
> that
> > > image, but I am not. I just have plain reference to java.awt.Image and
> I
> >
> > > need a way to display it in SWT.
> > >
> > > I am not expert in AWT nor SWT, but I expect a lot of such people
> > > subscribed to this mailing list. Can somebody help me, please?
> > >
> > > Thank you in advance.
> > > jst
> > >
> > > --
> > >
> > > _______________________________________________
> > > Sign-up for your own FREE Personalized E-mail at Mail.com
> > > http://www.mail.com/?sr=signup
> > >
> > >
> > > 1 cent a minute calls anywhere in the U.S.!
> > >
> > > http://www.getpennytalk.com/cgi-bin/adforward.cgi?p_key=RG9853KJ&url=http://www.getpennytalk.com
> > >
> > > _______________________________________________
> > > platform-swt-dev mailing list
> > > platform-swt-dev@xxxxxxxxxxx
> > > http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
> > >
> > >
> > >
> > > _______________________________________________
> > > platform-swt-dev mailing list
> > > platform-swt-dev@xxxxxxxxxxx
> > > http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
> > >
> > >
> >
> > --
> >
> > _______________________________________________
> > Sign-up for your own FREE Personalized E-mail at Mail.com
> > http://www.mail.com/?sr=signup
> >
> >
> > 1 cent a minute calls anywhere in the U.S.!
> >
> > http://www.getpennytalk.com/cgi-bin/adforward.cgi?p_key=RG9853KJ&url=http://www.getpennytalk.com
> >
> >
> >
> >
> > _______________________________________________
> > platform-swt-dev mailing list
> > platform-swt-dev@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
> >
> >
>
> --
>
> _______________________________________________
> Sign-up for your own FREE Personalized E-mail at Mail.com
> http://www.mail.com/?sr=signup
>
>
> 1 cent a minute calls anywhere in the U.S.!
>
> http://www.getpennytalk.com/cgi-bin/adforward.cgi?p_key=RG9853KJ&url=http://www.getpennytalk.com
>
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
>
>
>
--
_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup
1 cent a minute calls anywhere in the U.S.!
http://www.getpennytalk.com/cgi-bin/adforward.cgi?p_key=RG9853KJ&url=http://www.getpennytalk.com