How to Use a JPanel in a Single-Sourced RAP/RCP app? [message #113466] |
Tue, 25 November 2008 23:50  |
Adam Messages: 25 Registered: July 2009 |
Junior Member |
|
|
Hello,
So as some of you may know I am still struggling to single-source an RCP
application I have developed. The only thing that isn't working is this
one component which is an extension of a JPanel. It was suggested that I
turn it into an image on the Server-side.
I found out that JPanels have a CreateImage method, but that is an AWT
image, not an SWT image. Unfortunately, to convert from AWT to SWT imgae,
you have to use two SWT classes that are not supported by RAP (ImageData
and PalettedData).
I then tried to turn my AWT image into a raw PNG file, and still
Image swtImage = new Image(display, "graph.png");
it barks at me because I guess org.eclipse.swt.graphics.Image is not
supported in RAP.
So basically, I have a JPanel, and I need it to be displayed correctly in
my single-sourced RAP/RCP application. I can successfully turn it into a
png file, but I'd like to use as much of a direct method as possible.
|
|
|
Re: How to Use a JPanel in a Single-Sourced RAP/RCP app? [message #113506 is a reply to message #113466] |
Wed, 26 November 2008 08:12   |
Stefan  Messages: 316 Registered: July 2009 |
Senior Member |
|
|
Hi Adam,
org.eclipse.swt.graphics.Image is supported. If you have an InputStream
of your PNG-file you can use Graphics#getImage(path, is) to get an Image
instance and make the image visible to the browser (at the given path).
Hope that helps,
Stefan.
Adam schrieb:
> Hello,
>
> So as some of you may know I am still struggling to single-source an RCP
> application I have developed. The only thing that isn't working is this
> one component which is an extension of a JPanel. It was suggested that I
> turn it into an image on the Server-side.
>
> I found out that JPanels have a CreateImage method, but that is an AWT
> image, not an SWT image. Unfortunately, to convert from AWT to SWT
> imgae, you have to use two SWT classes that are not supported by RAP
> (ImageData and PalettedData).
>
> I then tried to turn my AWT image into a raw PNG file, and still
> Image swtImage = new Image(display, "graph.png");
>
> it barks at me because I guess org.eclipse.swt.graphics.Image is not
> supported in RAP.
>
> So basically, I have a JPanel, and I need it to be displayed correctly
> in my single-sourced RAP/RCP application. I can successfully turn it
> into a png file, but I'd like to use as much of a direct method as
> possible.
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01941 seconds