I have take the SVGApplication
(http://xmlgraphics.apache.org/batik/using/swing.html) and amended it
slightly to place the JSVGCanvas into another panel and then add panel to
the center of the layout panel viz:
JPanel svgpanel = new JPanel( new FlowLayout(FlowLayout.CENTER));
svgpanel.add( svgCanvas );
panel.add("Center", svgpanel);
(The reason is I want to add more JSVGCanvas' to the panel)
The canvas no longer resizes to the same size as the frame.
To overcome this I have placed a component listener onto the new panel viz:
svgpanel.addComponentListener( new ComponentListener(){
public void componentResized(ComponentEvent e)
{
JPanel panel = (JPanel)e.getSource();
int count = panel.getComponentCount();
System.out.println("Count: " + count );
if ( count > 0 )
{
int width = panel.getWidth() / count;
int height = panel.getHeight();
System.out.println("Width: " + width + " Height: " + height );
for ( int i=0; i<count; i++ )
{
JSVGCanvas canvas = (JSVGCanvas)panel.getComponent(i);
canvas.setMySize( new Dimension( width, height ) );
}
}
}
....etc
});
On resizing the frame the JSVGCanvas gets resized every alternate time - the
GVTTreeRendererListener only gets called every alternate resize.
Is this a bug or am I doing something wrong?
Rowena
--
View this message in context:
http://www.nabble.com/JSVGCanvas-re-renders-every-other-resize-tf4414584.html#a12592530
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]