I have a mobile map application in which the map needs to be rotated. The
logic for rotation is as following:
a. extension of basic mapPanel as shown below
public class MMI extends *BasicMapPanel* {
public static MapBean mapBean1;
b. Overriding the paint method of basic map Panel in class MMI
*public void renderShape() {*
* repaint();*
* }*
*public void paintComponent(Graphics g) {*
* super.paintComponent(g);*
* Graphics2D g2 = (Graphics2D) g;*
* if (firstTime) {*
*
*
* Rectangle d = mapBean.getBounds();*
* int w = d.width;*
* int h = d.height;*
* at.setToIdentity();*
*
*
* at.translate(w / 2, h / 2);*
* firstTime = false;*
* }*
*
*
*
*
* Rectangle rm = mapBean.getBounds();*
* AffineTransform mapTransform = new AffineTransform();*
* mapTransform.concatenate(at);*
* mapTransform.translate(-(rm.width / 2), -(rm.height / 2));*
* g2.transform(mapTransform);*
* }*
The paint method gets called from renderShape() above. I can rotate the map
with at.rotate command and it works fine on repaint. The above is created in
openmap frame.
However, once i try to put the jframe instead of openmap frame, the repaint
does not call the paintComponent(...) above and no rotations takes place
with at.rotate.
I am using JFrame instead of openmap frame for adding GUI components with
proper layout.
I would appreciate if someone can help in this.
Thanks,
Usman
--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Sep 27 2010 - 06:40:42 EDT