The addMapPolygon() method of the JMapViewer works for JMapViewer , but paintPolygon() silently rejects a polygon with less than three vertices. For a line between two points, simply repeat the last Coordinate .
Coordinate one = new Coordinate(...); Coordinate two = new Coordinate(...); List<Coordinate> route = new ArrayList<Coordinate>(Arrays.asList(one, two, two)); map.addMapPolygon(new MapPolygonImpl(route));
source share