sorry, but in this way the application show me a window that contain a slider
and a button, and on center nothing (only gray)...

public SVGApplication(JFrame f) {
        frame = f;
        svgCanvas = new JSVGCanvas();
        svgCanvas2 = new JSVGCanvas();
        //svgCanvas.setOpaque(true);
        //svgCanvas2.setOpaque(false);
        //svgCanvas2.setBackground(new Color(0,0,0,0));
    }

    public JComponent createComponents() {
        // Create a panel and add the button, status label and the SVG
canvas.
        panel = new JPanel(new BorderLayout());
        layer = new JLayeredPane();
        svgCanvas2.setBackground(new Color(0,0,0,0));
        layer.add(svgCanvas, new Integer(2));
        layer.add(svgCanvas2, new Integer(1)); 
        
        JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
        p.add(button);
        p.add(getJSlider(), null);
        p.add(label);
        
        panel.add("North", p);

        panel.add("Center", layer);

        
        // Set the button action.
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent ae) {
                JFileChooser fc = new JFileChooser(".");
                int choice = fc.showOpenDialog(panel);
                if (choice == JFileChooser.APPROVE_OPTION) {
                    File f = fc.getSelectedFile();
                    try {
                        if(svgCanvas.getURI() == null){
                                
svgCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
                                svgCanvas.setURI(f.toURL().toString());
                                
                        }else{
                        
svgCanvas2.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
                                svgCanvas2.setURI(f.toURL().toString());     
                        }
                    } catch (IOException ex) {
                        ex.printStackTrace();
                    }
                }
            }
        });
        
        return panel;
    }
}

-- 
View this message in context: 
http://www.nabble.com/load-2-svg-file-into-1-svgCanvas-tf3492392.html#a9771659
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to