The content that you want scrollable must be on the pane passed to the JScrollBar. Also, it must be populated with content before you pass it or it may have problems ascertaining the dimension. At least I know this was a problem in JDK 1.6, but yeah. Post your code else we won't know for sure.
|
Java
JPanel inside a JPanel inside a JScrollPane, not able to scroll |
(Dec 13, 2014 04:18 PM)MrOrang Wrote: JPane needs to be Scrollable which is obviously isn't. Look for a container that implements scrollable then add that component to the scrollpane. Correct me if I'm wrong, but I think this is what he wants to do: http://pastebin.com/2jmkyGhi Which results in a scrollable nested cluster of panels: ![]() My money is still on the fact that when you dynamically add into a scroll panel in java, it's a little problematic because the ScrollPanel logic dictates its vertical and horizontal size at construction and on repaints. There are some methods that allow you to fire that the internal data has changed though, but they're a little complicated and I'd need to see your code first before bothering with an example on that. You could try to just call repaint() on it, but I don't know if that'd do it. If you want me to help you out and invest time creating a panel that scrolls that you can add and remove from, let me know and I'll help you out. (Dec 13, 2014 04:55 PM)Bibl Wrote: call validate on it Ahahaha, I knew there was a method to toggle dataChanged. Nice call. Just like fireDataChanged() when dealing with JTable. I got lazy and didn't look it up xD.
I just also remembered, if there is no layout set for the panel that is inside of the scroll pane, the size is not dynamically passed to the parent component. So, setting a layout may also help you if you have not.
EDIT: Oh, fuck me, you're using a GUI builder? No wonder you're having problems. |
|
|

![[Image: c6b61de4adbdceada44854c4b80cda65.gif]](https://i.gyazo.com/c6b61de4adbdceada44854c4b80cda65.gif)