xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: JSVGCanvas re-renders every other resize
Date Wed, 12 Sep 2007 11:06:53 GMT
Hi Rowena,

RowGallagher <rowena.a.gallagher@lmco.com> wrote on 09/10/2007 09:12:37 

>     JPanel svgpanel = new JPanel( new FlowLayout(FlowLayout.CENTER));

> The canvas no longer resizes to the same size as the frame.

   I don't think FlowLayout will resize it's children to it's size.
Which is why it doesn't resize it's self any more

> To overcome this I have placed a component listener onto the new panel 

   This is the right thing to do, but...

>     svgpanel.addComponentListener( new ComponentListener(){
>       public void componentResized(ComponentEvent e)
>       {
>             JSVGCanvas canvas = (JSVGCanvas)panel.getComponent(i);
>             canvas.setMySize( new Dimension( width, height ) );

   The default implementation of setMySize only set's the preferred
size of the canvas.  I suspect that doesn't take effect until the
next resize event happens.  You probably need to add a pack at the
end of the component listener to trigger swing to layout the components
a second time with the new sizes.

   But to be honest I'm not very good with the Swing component
resize/placement framework...

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

View raw message