How's it going guys,
I'm currently working on a program that displays Google maps inside a JPanel
using Java 2D, however I've ran into problems with screen repaints, where
the right-middle portion of the map view doesn't display properly. Dragging
the mouse to move the map, or even repositioning the map view results in
only that portion of the screen to the right ending up with garbled images;
the rest of the screen displays without problems. My paintComponent() method
for the JPanel is as follows:
protected void paintComponent(Graphics g) {
Graphics2D canvas = (Graphics2D) g;
super.paintComponent(g);
canvas.setColor(BACKGROUND_COLOR);
canvas.fillRect(0, 0, this.getWidth(), this.getHeight());
// this.image: A BufferedImage containing the Google map view.
canvas.drawImage(this.image, 0, 0, this.getSize().width -
(RIGHT_MARGIN +
LEFT_MARGIN), this.getSize().height - (TOP_MARGIN +
BOTTOM_MARGIN), null);
}
I call repaint() whenever anything happens to the map. I'm really not sure
what's causing the problem, so any ideas would be great.
Cheers,
Simon Liu
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".