Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to Use a JPanel in a Single-Sourced RAP/RCP app?
How to Use a JPanel in a Single-Sourced RAP/RCP app? [message #113466] Tue, 25 November 2008 18:50 Go to next message
Eclipse UserFriend
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 03:12 Go to previous messageGo to next message
Eclipse UserFriend
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.
>
Re: How to Use a JPanel in a Single-Sourced RAP/RCP app? [message #113607 is a reply to message #113506] Wed, 26 November 2008 08:21 Go to previous messageGo to next message
Eclipse UserFriend
Since I'm not using a constructor to declare who my parent is...how will I
be able to place my image into my Component/Shell/Display?
Re: How to Use a JPanel in a Single-Sourced RAP/RCP app? [message #113633 is a reply to message #113607] Wed, 26 November 2008 09:36 Go to previous message
Eclipse UserFriend
Hi Adam,

Have you tried Control#setBackgroundImage() ?
Maybe this works...
Stefan.

Adam schrieb:
> Since I'm not using a constructor to declare who my parent is...how will
> I be able to place my image into my Component/Shell/Display?
>
Previous Topic:Dynamic JFree Charts in Rap
Next Topic:RAP and (cluster-)failover
Goto Forum:
  


Current Time: Wed Jul 23 15:44:18 EDT 2025

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

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

Back to the top