Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Java 

JPanel inside a JPanel inside a JScrollPane, not able to scroll

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.
(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.

Kinda tired right now so I may be wrong but I think that's your problem.

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:
[Image: c6b61de4adbdceada44854c4b80cda65.gif]

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.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by FryPanJul 4, 2018 03:05 PM 2 200 Jul 4, 2018 03:05 PM
Last Post: FryPan
[.NET] by monemdsNov 17, 2017 10:46 AM 2 214 Nov 17, 2017 10:46 AM
Last Post: monemds
[.NET] by VmX5Apr 5, 2017 03:26 AM 4 321 Apr 5, 2017 03:26 AM
Last Post: Zilog80