Put your
javax.swing.JPanel
on a
javax.swing.JScrollPane
like this:
JPanel pnlImage = new JPanel(new BorderLayout());
JScrollPane spnImage = new JScrollPane(pnlImage);
Then instead of placing the panel
pnlImage
on your container or frame, place the scroll pane
spnImage
on it.