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)
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.