Hi Rowena,
RowGallagher <[EMAIL PROTECTED]> wrote on 09/10/2007 09:12:37
AM:
> 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
viz:
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]