thomas.deweese wrote:
>
> Hi Peppe,
>
> Peppe <[EMAIL PROTECTED]> wrote on 03/31/2007 11:31:37 AM:
>
>> i try to change my question...there is a method to show 1 or 2
> JSVGCanvas
>> (both contains svg document) that are one above the other?...
>
> Yes, you can set the background color for the top canvas to fully
> transparent. Then tell Swing the top Canvas is transparent (so it
> knows to paint the one underneath) then you can just stack the two
> canvases with an appropriate layout manager.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
i get and modified the code from batik site in this way:
public SVGApplication(JFrame f) {
frame = f;
svgCanvas = new JSVGCanvas();
svgCanvas2 = new JSVGCanvas();
svgCanvas2.setOpaque(false);
}
public JComponent createComponents() {
// Create a panel and add the button, status label and the SVG
canvas.
panel = new JPanel(new BorderLayout());
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", svgCanvas);
panel.add("Center", svgCanvas2);
// 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;
}
}
but in this way it shows only the second document that i load....i would
that it shows both document superimposed...
--
View this message in context:
http://www.nabble.com/load-2-svg-file-into-1-svgCanvas-tf3492392.html#a9769649
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]