Hello everyone,
I have the following problem: I have JScrollPane containing an image. The scrollpane is inside a JPanel together with other components in order to be able to layout the whole thing with a BorderLayout (the scrollpane is the CENTER and I have something in the SOUTH). This JPanel is in a JSplitPane. The JSplitPane is finally inside a JFrame.
JFrame { JSplitpane { JPanel(BorderLayout) { JScrollPane(CENTER) { BufferedImage }
JPanel(SOUTH) {...} } } }
My problem now is that when I resize my frame the image in the scrollPane resizes fine until it reaches the images size. Then the image is stretched which I want to prevent. I tried wrapping the JScrollPane in a JPanel that is layout with a FlowLayout. That works fine for the resizing bit but the scrollbars disappear once I resize the frame.
I overrode the scrollPane's setSize() method and found out that the size of the scrollpane is always set to the image's size once the frame is resized. I don't have a clue how to fix that though.
Every hint is appreciated.
Cheers,
Ben