this.panel = panel;
}
public void paintComponent(Graphics g)
{
NanoGraph nanograph = panel.getNanoGraph();
if(nanograph.getGraphHeight() == 0 ||
nanograph.getGraphWidth() == 0)
return;
Graphics2D g2d = (Graphics2D) g;
// clear
g2d.setColor(Color.WHITE);
g2d.fillRect(0,0,getWidth(), getHeight());
// compute scale
double scale = (double)Math.min(
getHeight()/(double)nanograph.getGraphHeight(),
getWidth()/(double)nanograph.getGraphWidth()
);
g2d.scale(scale, scale);
// draw outline
g2d.setColor(Color.lightGray);