In my java application i am including an image in my applet by browsing through a dialog box, which can browse the image from my system wherever it is present. For example in c: drive or d: drive......
Same way if I want to browse power point presentations and want to display it on the applet, how can i do that?
In my java application i am including an image in my applet
I'm confused - is this an applet or an application? This matters because applets run under security restrictions that won't allow them to perform file I/O unless the applet is signed or the local security policy altered (you can find more about that here).
You would use the java.awt.FileDialog or javax.swing.JFileChooser classes to browse for files.
The hardest part would be to display PPT files. I'm not aware of an AWT or Swing component that can do that. It's not hard to read PPT files with the help of the Apache POI library, though. It lets you extract slide titles, text, images, notes and other information for each slide. You'll just have to display those in a meaningful way in the applet.
Hi Ulf Dittmer, Thanks for your reply. I apologize for not making myself clear. Its an applet actually. In my applet i have a canvas for displaying the images. Now i want to display the ppt file in this canvas. Is it possible or not? I did not find any appropriate solution for this on the net. Regards,
Joined: Mar 22, 2005
You can't display it in the way you can display an image, because there's nothing in the class libraries that understands PPT files.
But as I said, it's not hard to use POI to read PPT files and iterate through their contents, displaying the slides' contents as appropriate. (If you want to show transitions etc. it gets a whole lot more complicated, of course.)