xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas DeWeese <Thomas.DeWe...@Kodak.com>
Subject Re: JSVGScrollPane question
Date Wed, 23 Jun 2004 18:11:25 GMT
Hi Nikhil,

Nikhil Dinesh wrote:

> Ive managed to fix resizing on the scrollpane by setting the viewBox on
> a GVTTreeRenderingCompleted event notification. But I have to do it
> explicitly.

   To use the JSVGScrollPane your SVG document should have a viewBox
attribute on the outermost svg element.  This is how it determines
what the extents of the scroll bars should be.  If you want you
can load the SVG document yourself and add the viewBox attribute
before giving the document to the canvas.

   This should be documented and there should be better checking
along with a better error message when the check fails (or it could
default to the final 'computed' bounds of the SVG - although this
can often be 'wrong'.  Contributions are always welcome.

> 
> 
> On Tue, 22 Jun 2004, Nikhil Dinesh wrote:
> 
> 
>>Hi,
>>
>>I was trying to use the JSVGScrollPane and it kept throwing
>>NullPointerExceptions. After tracing the execution I found that it seems
>>to check the viewBox before setting it. I hacked around this doing the
>>following:
>>
>>public class MySVGScrollPane extends JSVGScrollPane{
>>
>> public MySVGScrollPane(JSVGCanvas canvas){
>>     super(canvas);
>>     super.viewBox = new java.awt.geom.Rectangle2D.Float(0,0,10000,10000);
>>     super.ignoreScrollChange = false;
>> }
>>}
>>
>>This keeps the scrollbars constant which is again weird it be resizing
>>according to changes in the document, right?
>>
>>
>>The code which uses the scroll pane is something like:
>>
>>JPanel panel = new JPanel(layout...)
>>JSVGCanvas myCanvas = new JSVGCanvas();
>>myCanvas.setDocumentState(JSVGCanvas.ALWAYS_STATIC) [other options produce
>>the same results]
>>
>>panel.add(new JVGScrollPane(myCanvas));
>>
>>.....(the document is set by some user initiated action)
>>
>>
>>Am I using this the wrong way?
>>
>>Thanks,
>>-Nikhil
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org


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


Mime
View raw message