This can easily be done using a zoom factor
ex:-
double zoomFactor = 1;
/*
when zoomFactor is 1 no zooming is used
when zoomFactor > 1 is zoom In
when zoomFactor < 1 is zoomOut
*/
//paintComponent method
g.drewLine(x1*zoomFactor, y1*zoomFactor, x2*zoomFactor, y2*zoomFactor);
if you want to enable scrolling you will need to impliment the getMaximumSize(), getMinimumSize(), getPreferedSize() methods to return the size by applying the zoomFactor
Every time the zoomFactor changes you have to repaint
lrmka
| Sun, 15 Jul 2007 16:59:00 GMT |