AFAIK JMapViewer extends JPanel.
Therefore you just override paintComponent and use the given Graphics object.
class MyMap extends JMapViewer {
@Override
protected void paintComponent(Graphics g){
super.paintComponent(g);
g.setColor(Color.RED);
g.drawPolyline(...);
}
}