• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

display CGM images iingn web browser with out using any viewer in java

 
deepthi kaja
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to disaply cgm image in java enabled web browser(with out using viewers) and image shd be zoom in and zoom out,Can any body help me in this regard.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

This looks promising.
 
deepthi kaja
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ya i tried with CGM viewer applet (CGMVA),I can only able to see CGM image but i am unable to Zoom in /Zoom out the image .. fallowing are my runtime errors(exceptions).

Exception in thread "AWT-EventQueue-2" java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
at sun.awt.Win32GraphicsConfig.createAcceleratedImage(Unknown Source)
at sun.awt.windows.WComponentPeer.createImage(Unknown Source)
at java.awt.Component.createImage(Unknown Source)
at CgmViewApplet.a(Unknown Source)
at o.componentResized(Unknown Source)
at java.awt.Component.processComponentEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "AWT-EventQueue-3" java.lang.NullPointerException
at CgmViewApplet.a(Unknown Source)
at o.componentResized(Unknown Source)
at java.awt.Component.processComponentEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

please help me to solve these.its very urgent.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The applet code has a couple of problems that prevent it from working properly on some platforms/JVMs. Try this version instead. I changed a few things, and now it works fine for me.
[ April 08, 2008: Message edited by: Ulf Dittmer ]
 
deepthi kaja
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have removed cgmva191.jar from library,i have added your cgmVA.jar file ,build the application,I found errors i.e package netscape.javascript.*;does not exists.i solved this by adding cgmVA.Zip to library,again i build the application ,Buils was successful,when i try to view homto.html and toolbar.html,i can able to see the cgm image,but when i try to ckick on the image for zooming it is throwing me runtime exceptions.but it is working good to the author of CGMVA can able to zoom in /out with out any errors on java console.below are the runtime exceptions on java console.

Please help me.............its urgent.As well as i want to do automatic hotspoting for my image.

Java Plug-in 1.6.0_05
Using JRE version 1.6.0_05 Java HotSpot(TM) Client VM
User home directory = C:\Users\krishna


----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
p: reload proxy configuration
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------

Exception in thread "AWT-EventQueue-2" java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
at sun.awt.Win32GraphicsConfig.createAcceleratedImage(Unknown Source)
at sun.awt.windows.WComponentPeer.createImage(Unknown Source)
at java.awt.Component.createImage(Unknown Source)
at CgmViewApplet.a(Unknown Source)
at o.componentResized(Unknown Source)
at java.awt.Component.processComponentEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Unknown attribute: 42
Unknown attribute: 19
Unknown attribute: 20
Unknown attribute: 37
Unknown attribute: 38
Exception in thread "AWT-EventQueue-3" java.lang.IllegalArgumentException: Width (0) and height (0) cannot be <= 0
at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
at sun.awt.Win32GraphicsConfig.createAcceleratedImage(Unknown Source)
at sun.awt.windows.WComponentPeer.createImage(Unknown Source)
at java.awt.Component.createImage(Unknown Source)
at CgmViewApplet.a(Unknown Source)
at o.componentResized(Unknown Source)
at java.awt.Component.processComponentEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Unknown attribute: 44
Unknown attribute: 45

Please help me.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to build anything. In fact, you can't even build it, because I didn't include the source code for my changes. Just use my jar file instead of the other one. It works fine in appletviewer, Firefox and Safari.
 
deepthi kaja
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please explain me in more detail,which file i have to execute to get the same output?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just use the jar file I linked to above instead of the jar or zip file used by the examples. You will need to change the archive attribute of the applet tag accordingly.
 
deepthi kaja
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your support...
Still I am getting errors I have downloded cgmva.zip from www.bdaum.de,i have unzipped and added to project(netbeans ide ->projects-new project).Next added your jar to library folder then changed in howto.html changes archive in howto.html
<TR> <TD><IMG src="cgmva\AFRICA.GIF" alt="africa.gif" width="200" height="195"></TD> <TD><IMG src="cgmva\AFRICA.JPG" alt="africa.jpg" width="200" height="195"></TD> <TD><APPLET code="CgmViewApplet.class" archive="cgmva\cgmVA.jar" codebase="" width="200" height="200"><PARAM name="cgmArchive" value="cgmva\AFRICA.zip">

can you please send me the working code and executable instructions to figure out.I will in urgent need.. Also I would like to send screen shots,but i am unable to attach here...can you please give me your email so that i can send screen shots as well if you need.I hope you understood my problem.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand what you're trying to do. You don't need to build anything, and NetBeans (or any IDE) has nothing to do with this. Here's what you can do:

Create a file callet "applet.html" which contains the following:

Put it into a directory with the jar I linked to and the file AFRICA.ZIP. Then you can open the HTML file with a browser or appletviewer, and the CGM file will be displayed just fine.
 
deepthi kaja
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much.now it is working fine with Africa image then i tried to display with my (cgm) image but my original(cgm) image is combined with other images(behind the scene image),i mean my image is fluxed ,that is CGM Image, that�s being displayed, has different layers as part of the image. Need is to display final layer with original image. With this code, by default it shows all the layers, is there a way to display Top Most layer only.

Another requirement is Automatic Hot-spotting in CGM Images: Is there a way to recognize the click on the callout/hotspot on the image and on click of Callout, can the corresponding part displayed at the bottom of the image in web page be selected�

Are there any tools/plug-in that can help in achieving this?

Below is my image:
 
deepthi kaja
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any body help me out for Automatic Hot-spotting in CGM Images:
Is there a way to recognize the click on the callout/hotspot on the image and on click of Callout, can the corresponding part display at the bottom in web page.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The howto.htm page of the applet talks about hiding layers in the "Visibility" section.

It also mentions calling JavaScript methods in response to mouse or key events; that should allow you to display anything the URL of some particular frame.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic