JPanel backround question
I would like to use a picture as a background for a JPanel. But I would also like to put a JScrollpane in the JPanel. Can I have both of those at the same time? Thanx
I would like to use a picture as a background for a JPanel. But I would also like to put a JScrollpane in the JPanel. Can I have both of those at the same time? Thanx
Put the JPanel in the JScrollPane.
I'm not sure if setting a JScrollPane's opacity to "false" allows it to show through, but it's worth a try.
Joe
Message was edited by:
Joe_h
> I would like the scrollpane to be smaller than the
> picture
JScrollPane.setSize(smaller than picture);
my problem is that the scrollpane does not show up at all. I'm putting the picture on the jpanel in the paint method, is that wrong?
> my problem is that the scrollpane does not show up at
> all. I'm putting the picture on the jpanel in the
> paint method, is that wrong?
after adding the jpanel to the scrollpane
add the scrollpane in the parent component.
e.g. JFrame, JWindow... etc..
In the future, Swing related questions should be posted in the Swing forum.
You can search the Swing forum for this solution. This question is asked all the time. "background image" would be the common search keywords.
What I'm trying to do is have a JPanel of size 10 by 10, put a 10 by 10 pitcure in it as a background, then in the middle I want to put a 5 by 5 scrollpane with other stuff in it.