JScrollPane + Image
Hello, I don't know where is error??
JPanel panel = new
public void paintComponent(Graphics g)
if (image != null)
g.drawImage(image, 0, 0, null);
JScrollPane imageScrollPanel = new JScrollPane();
frame.add( imageScrollPanel, BorderLayout.CENTER );
Can you provide the error?
the image is shown but the scroll bars are not visible and the scroll view does not work. Any suggestions on that?
Have you tried constructing a ImageIcon from the Image, adding it to a JLabel and adding that to the JPanel?
I can't do it, because after I must edit Image (for example filter)
You seem to be adding the panel to both the frame and the scrollpanel.
Originally Posted by Jyzef
Also, as far as i understand you should be using
instead of making a scroll panel and then adding the panel to it.
JScrollPane imageScrollPanel = new JScrollPane(panel);