xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thierry Kormann <tkorm...@ilog.fr>
Subject Re: JSVGCanvas' s problem
Date Mon, 17 Sep 2001 16:32:42 GMT
On Monday 10 September 2001 08:25, é×ÁÎ ëÁÒÄÁÛÏ× wrote:
> Hello!
> I have some problems with JSVGCanvas
> When i write:
> /-------------------------------------------------
>         JFrame f = new JFrame("MY FRAME");
>         JSVGCanvas svgCanvas = new JSVGCanvas();
>         f.getContentPane().add(svgCanvas);
>         f.setSize(400, 400);
>         f.setVisible(true);
>         f.show();
> 	Graphics2D g = (Graphics2D)svgCanvas.getGraphics();
> 	g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
>                            RenderingHints.VALUE_ANTIALIAS_ON);
>
> // and, for example, paint some ellipse
>
>         Ellipse2D ellipse = new Ellipse2D.Float(20, 0, 60, 60);
>         g.setPaint(new Color(176, 22, 40));
>         g.fill(ellipse);
>
>
> /-------------------------------------------------
>
> why the ellipse disappear after any manipulation with the window
> And maybe smth else i should use in the program to view
> a graphical object properly?

The paintComponnet method of the JSVGCanvas just draw a BufferedImage that 
represents your SVG drawing. The size of the image is set according to the 
size of the component. That means that each time, the paintComponent is 
called, the whole surface is covered by the image.

You could draw your stuffs *after* calling super.paintComponent. In that 
case, your drawing will be done on top of the image.

Hope that helps.

Thierry.


---------------------------------------------------------------------
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