hi I also had the same problem , I overcome it by using *XOR *mode in java
awt
here is a code segment
to move a rect shape without fliker
Rectangle regionRect = new Rectangle();
public void moveRectanglePreview(MapMouseEvent e, GeoRect geoRect) {
x = e.getX();
y = e.getY();
/*
geoRect is the user defined one which has the rectagle info
calculate pixel width & height of the shape
*/
*height *= (int) (Math.abs(geoRect.getY2() - geoRect.getY1()) *
getMapPane().getWorldToScreenTransform().getScaleX());
*width *= (int) (Math.abs(geoRect.getX2() - geoRect.getX1()) *
getMapPane().getWorldToScreenTransform().getScaleX());
Graphics2D graphic = (Graphics2D) getMapPane().getGraphics();
graphic.setColor(geoRect.getColor());
graphic.setXORMode(Color.WHITE);
if (dragging) { /*
to avoid initial draw
*/
graphic.drawRect(regionRect.x, regionRect.y, regionRect.width,
regionRect.height);
}
regionRect.setFrame(x - width / 2, y - height / 2, width, height);
/* *to set the mouse cursor with the centre of the rect, while moving **/
graphic.drawRect(regionRect.x, regionRect.y, regionRect.width,
regionRect.height);
dragging = true;
}
I simply call this method on jmappane's mouse dragged method
on mouse released I call the original /move(destX, destY) ;/ method to move
the original shape
so no map flickering while moving.
I 've also implemented the move, resize methods for CIRCLE, RECT, POLYGON.
hope this is helpful :)
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Drawing-into-GlassPane-does-not-work-tp5679897p6951171.html
Sent from the geotools-gt2-users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
RSA® Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users