I cannot display SVG files by using JSVGCanvas

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

I cannot display SVG files by using JSVGCanvas

Nakatsuji Makoto
Hi!

I have a problem in building my application.
I look up the solution for this problem, but I cannot
find it.
Please help me.

I try to visualize svg document in my swing application by using
JSVGCanvas, so I read JSVGCanvas tutorial and write the code like
below.  In my code, I specified URI of a svg file for the method of
JSVGCanvas.setURI. But, nothing is displayed in my JFrame.  How to
display svg files in JFrame?

I show my program code and error logs below.

Thank you!

##### program code #######

import javax.swing.JFrame;

import org.apache.batik.swing.JSVGCanvas;


public class TestPane extends JFrame {

        private javax.swing.JPanel jContentPane = null;

        private JSVGCanvas jJSVGCanvas = null;

        private JSVGCanvas getJSVGCanvas() {
                if (jJSVGCanvas == null) {
                        jJSVGCanvas = new JSVGCanvas();
                }
                return jJSVGCanvas;
        }
        public static void main(String[] args) {
                new TestPane();
        }
        /**
         * This is the default constructor
         */
        public TestPane() {
                super();
                initialize();
        }
        /**
         * This method initializes this
         *
         * @return void
         */
        private void initialize() {
                this.setEnabled(true);
                this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                this.setSize(544, 323);
                this.setContentPane(getJContentPane());
                this.setTitle("JFrame");
                this.setVisible(true);
                jJSVGCanvas.setURI("file:/C:/batik-1.6/samples/gradients.svg");
        }
        /**
         * This method initializes jContentPane
         *
         * @return javax.swing.JPanel
         */
        private javax.swing.JPanel getJContentPane() {
                if(jContentPane == null) {
                        jContentPane = new javax.swing.JPanel();
                        jContentPane.setLayout(new java.awt.BorderLayout());
                        jContentPane.add(getJSVGCanvas(), null);

                }
                return jContentPane;
        }
}  //  @jve:decl-index=0:visual-constraint="29,14"


###### error log ###########

java.lang.ExceptionInInitializerError
        at org.apache.batik.swing.JSVGCanvas$CanvasUserAgent.displayError(JSVGCanvas.java:1045)
        at org.apache.batik.swing.svg.JSVGComponent$BridgeUserAgentWrapper.displayError(JSVGComponent.java:2206)
        at org.apache.batik.swing.svg.JSVGComponent$SVGListener.documentLoadingFailed(JSVGComponent.java:1346)
        at org.apache.batik.swing.svg.SVGDocumentLoader$4.dispatch(SVGDocumentLoader.java:160)
        at org.apache.batik.util.EventDispatcher.dispatchEvent(EventDispatcher.java:102)
        at org.apache.batik.util.EventDispatcher.fireEvent(EventDispatcher.java:86)
        at org.apache.batik.util.EventDispatcher$1.run(EventDispatcher.java:45)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:171)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Caused by: java.util.MissingResourceException: Can't find bundle for base name org.apache.batik.util.gui.resources.JErrorPane, locale ja_JP
        at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:804)
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:773)
        at java.util.ResourceBundle.getBundle(ResourceBundle.java:538)
        at org.apache.batik.util.gui.JErrorPane.<clinit>(JErrorPane.java:77)
        ... 14 more

##### My programming environment ############
Windows XP
Eclipse 3.0.1
j2sdk1.4.2_02
batik1-6


Makoto Nakatsuji



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: I cannot display SVG files by using JSVGCanvas

Nakatsuji Makoto
Hi!

I resolve this problem by myself.

I make use of batik source files to build my own application,
but I can  display SVG files by using batik jar files.

Thank you!

On Mon, 23 May 2005 16:53:19 +0900
Nakatsuji Makoto <[hidden email]> wrote:

> Hi!
>
> I have a problem in building my application.
> I look up the solution for this problem, but I cannot
> find it.
> Please help me.
>
> I try to visualize svg document in my swing application by using
> JSVGCanvas, so I read JSVGCanvas tutorial and write the code like
> below.  In my code, I specified URI of a svg file for the method of
> JSVGCanvas.setURI. But, nothing is displayed in my JFrame.  How to
> display svg files in JFrame?
>
> I show my program code and error logs below.
>
> Thank you!
>
> ##### program code #######
>
> import javax.swing.JFrame;
>
> import org.apache.batik.swing.JSVGCanvas;
>
>
> public class TestPane extends JFrame {
>
> private javax.swing.JPanel jContentPane = null;
>
> private JSVGCanvas jJSVGCanvas = null;
>
> private JSVGCanvas getJSVGCanvas() {
> if (jJSVGCanvas == null) {
> jJSVGCanvas = new JSVGCanvas();
> }
> return jJSVGCanvas;
> }
> public static void main(String[] args) {
> new TestPane();
> }
> /**
> * This is the default constructor
> */
> public TestPane() {
> super();
> initialize();
> }
> /**
> * This method initializes this
> *
> * @return void
> */
> private void initialize() {
> this.setEnabled(true);
> this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
> this.setSize(544, 323);
> this.setContentPane(getJContentPane());
> this.setTitle("JFrame");
> this.setVisible(true);
> jJSVGCanvas.setURI("file:/C:/batik-1.6/samples/gradients.svg");
> }
> /**
> * This method initializes jContentPane
> *
> * @return javax.swing.JPanel
> */
> private javax.swing.JPanel getJContentPane() {
> if(jContentPane == null) {
> jContentPane = new javax.swing.JPanel();
> jContentPane.setLayout(new java.awt.BorderLayout());
> jContentPane.add(getJSVGCanvas(), null);
>
> }
> return jContentPane;
> }
> }  //  @jve:decl-index=0:visual-constraint="29,14"
>
>
> ###### error log ###########
>
> java.lang.ExceptionInInitializerError
> at org.apache.batik.swing.JSVGCanvas$CanvasUserAgent.displayError(JSVGCanvas.java:1045)
> at org.apache.batik.swing.svg.JSVGComponent$BridgeUserAgentWrapper.displayError(JSVGComponent.java:2206)
> at org.apache.batik.swing.svg.JSVGComponent$SVGListener.documentLoadingFailed(JSVGComponent.java:1346)
> at org.apache.batik.swing.svg.SVGDocumentLoader$4.dispatch(SVGDocumentLoader.java:160)
> at org.apache.batik.util.EventDispatcher.dispatchEvent(EventDispatcher.java:102)
> at org.apache.batik.util.EventDispatcher.fireEvent(EventDispatcher.java:86)
> at org.apache.batik.util.EventDispatcher$1.run(EventDispatcher.java:45)
> at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:171)
> at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
> at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
> at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
> at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
> Caused by: java.util.MissingResourceException: Can't find bundle for base name org.apache.batik.util.gui.resources.JErrorPane, locale ja_JP
> at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:804)
> at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:773)
> at java.util.ResourceBundle.getBundle(ResourceBundle.java:538)
> at org.apache.batik.util.gui.JErrorPane.<clinit>(JErrorPane.java:77)
> ... 14 more
>
> ##### My programming environment ############
> Windows XP
> Eclipse 3.0.1
> j2sdk1.4.2_02
> batik1-6
>
>
> Makoto Nakatsuji
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]

〒180-8585 東京都武蔵野市緑町3-9-11  
日本電信電話株式会社
ネットワークサービスシステム研究所  
中辻 真  ([hidden email])
TEL: (0422)59-7100  FAX: (0422)60-4012



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]