JPanel and JScrollPane inheritance
I am having some issues the the implementation of the JScrollPane in my gui. I was wondering if anybody had any ideas?
For my GUI i the following
JFrame
>JPanel (nav bar)
>JPanel (gridlayout dynamic based on house size)
>> JPanel(each grid/cell)
>>> Componts (label etc)
>> JPanel (Stat bar)
This works fine to select and work with my rooms(part of the project) in each grid. I have the listener attached to the gridlayout panel, so i know where my mouse has clicked and therefore which grid it belongs to. The listener is the mouselistener on the JPanel.
But when i place a JScrollPane in here;
JFrame
>JPanel (nav bar)
>JPanel (gridlayout dynamic based on house size)
>>jScrollPane
>>>JPanel(each grid/cell)
>>>>Components (label etc)
>>>JPanel (Stat bar)
To give me the scroll bars for each room, my gui no longer accepts the mouse event (it does but not on the gridlayout JPanel as it did before). Does anybody know how i can overide the JScrollPane and let my JPanel underneath receive the event?
I am struggle to find a way to do this that will adhere to the MVC structure. As the code to check and prepare everything is in the controller which just hands the basic info over to the view to repaint it all.
Or i am just completely going in the wrong direction :(
Re: JPanel and JScrollPane inheritance
I suggest you provide an SSCCE (that's a link) that demonstrates what you're talking about. That way, people who might want to help have something to play with instead of having to come up with something from scratch. Try to keep it as short as possible.
Re: JPanel and JScrollPane inheritance
Cross posted at JPanel and JScrollpane.... While crossposting is not against the rules of this forum, we encourage posters to be forthright in revealing where else they have posted their questions. For reasons, see The problems with crossposting