Zoom in and out
I am working on a Java project, based on calibrations, I generate a graph for which I need to implement the feature Zoom in and out. I must make it enlarge and small when the mouse scroll / wheel is moved up and down, or provide an option to enlarge when it is doubled clicked (like how it appears in windows image viewer)
Is this feasible to do. Could someone share their thoughts on this, so that I can get started.
Re: Zoom in and out
Yes you can.
There are a few different options. The solution I usually prefer is to add your pane into a JScrollPane. In order to allow you to make a custom binding for middle mouse wheel scrolling, you will probably want to disable scrolling with the mouse wheel (see the setWheelScrollingEnabled(boolean) method).
Then you just need to add a mouse listener and implement zooming/panning in here. To actually zoom, just change the preferred size for your graph component (see setPreferedSize(Dimension). Note that this method only works if your graph component takes into account the size of the component while painting.