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
> Yeah. I'd be interested in that too.
> The only suggestion I have is to change the size of
> what you are drawing by some factor. And also the
> e location.
>
> If you are using drawImage(), it will do the scaling
> for you.
thanks for you all guys for helping.
yes I'm using drawImage() and wants to know how to do scaling with that ?
If not i'll try to use the zoomFactor method.
can we use the any scaling method for the Graphics object ?
thanks