xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Snyder, Jim \( GE Transportation \)" <Jim.Sny...@Trans.ge.com>
Subject SVG and JLayeredPane
Date Mon, 31 Jan 2005 20:12:04 GMT
Hello,

I was able to get Batik to generate an SVG text output using the following algorithm (from
the Batik website) on java components such as a JPanel ( the this instance is of JPanel).



      try
      {

         DOMImplementation domImpl =
            GenericDOMImplementation.getDOMImplementation();

         // Create an instance of org.w3c.dom.Document
         Document document = domImpl.createDocument(null, "svg", null);

         // Create an instance of the SVG Generator
         SVGGraphics2D svgGenerator = new SVGGraphics2D(document);

         // Ask the test to render into the SVG Graphics2D implementation
         this.paint(svgGenerator);

         // Finally, stream out SVG to the standard output using UTF-8
         // character to byte encoding
         boolean useCSS = true; // we want to use CSS style attribute
         Writer out = new OutputStreamWriter(System.out, "UTF-8");
         svgGenerator.stream(out, useCSS);

      }
      catch (java.io.UnsupportedEncodingException e)
      {
                  e.printStackTrace();
      }
      catch (org.apache.batik.svggen.SVGGraphics2DIOException eSVGGraphics2DIOException)
      {
                  eSVGGraphics2DIOException.printStackTrace();
      }


However when I apply the same algorithm (the this instance is of MY_JLAYEREDPANE, which extends
JLayeredPane) to a JLayeredPane I get the following exception:


java.lang.NullPointerException
 	at javax.swing.JLayeredPane.paint(JLayeredPane.java:539)
	at MY.COM.MY_JLAYEREDPANE.paint(MY_JLAYEREDPANE.java:88)
 	at MY.COM.MY_JLAYEREDPANE.renderSVG2(MY_JLAYEREDPANE.java:126)
	at MY.COM.MY_JLAYEREDPANE.paint(MY_JLAYEREDPANE.java:92)
	at javax.swing.JComponent.paintChildren(JComponent.java:493)
	at javax.swing.JComponent.paint(JComponent.java:691)
	at javax.swing.JViewport.paint(JViewport.java:663)
	at javax.swing.JComponent.paintChildren(JComponent.java:493)
	at javax.swing.JComponent.paint(JComponent.java:691)
	at javax.swing.JComponent.paintChildren(JComponent.java:493)
	at javax.swing.JComponent.paint(JComponent.java:691)
	at javax.swing.JComponent.paintChildren(JComponent.java:493)
	at javax.swing.JComponent.paint(JComponent.java:691)
	at javax.swing.JLayeredPane.paint(JLayeredPane.java:541)
	at javax.swing.JComponent.paintChildren(JComponent.java:493)
	at javax.swing.JComponent.paint(JComponent.java:664)
	at java.awt.GraphicsCallback$PaintCallback.run(GraphicsCallback.java:18)
	at sun.awt.SunGraphicsCallback.runOneComponent(SunGraphicsCallback.java:49)
	at sun.awt.SunGraphicsCallback.runComponents(SunGraphicsCallback.java:86)
	at java.awt.Container.paint(Container.java:955)
	at sun.awt.RepaintArea.paint(RepaintArea.java:293)
	at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:191)
	at java.awt.Component.dispatchEventImpl(Component.java:2658)
	at java.awt.Container.dispatchEventImpl(Container.java:1208)
	at java.awt.Window.dispatchEventImpl(Window.java:923)
	at java.awt.Component.dispatchEvent(Component.java:2492)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:334)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:126)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:88)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:80)

I've searched Google with no success. and the mailing list websites referenced from the batik
is unsearchable. If you could reply directly to me that would be great.

I'm using Windows XP Pro on JDK 1.3.1.11.

Thanks...Jim


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message