Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 23:50 Go to next message
Adam is currently offline AdamFriend
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 Go to previous messageGo to next message
Stefan   is currently offline Stefan Friend
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.
>
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 13:21 Go to previous messageGo to next message
Adam is currently offline AdamFriend
Messages: 25
Registered: July 2009
Junior Member
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 14:36 Go to previous message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
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: Sun Feb 05 07:20:30 GMT 2023

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

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

Back to the top