The Source for Java Technology Collaboration
User: Password:



Start New Message Delete Post a Reply

Article: 
 Building Maps into Your Swing Application with the JXMapViewer
Subject:  Newbie question: Custom renderering
Date:  2007-11-06 07:09:14
From:  freddiefishcake
Response to: Newbie question: Custom renderering


solved the custom rendering with code like this:
//crate a WaypointPainter to draw the points
WaypointPainter painter = new WaypointPainter();
painter.setWaypoints(waypoints);
// our own custom renderer..
painter.setRenderer(new WaypointRenderer() {
public boolean paintWaypoint(Graphics2D g, JXMapViewer map, Waypoint waypoint) {
// get the weather
String name = ((WeatherWaypoint)waypoint).getName();
boolean statusOK = ((WeatherWaypoint)waypoint).isStatus();
// draw the waypoint
if (statusOK)
g.setColor(Color.CYAN);
else
g.setColor(Color.RED);
g.fillOval(-8,-8,16,16);
g.setColor(Color.BLACK);
g.drawString("" + name, -15,-10);
return false;
}
});

 Feed java.net RSS Feeds