Results 1 to 2 of 2
  1. #1
    ohiggins is offline Member
    Join Date
    Feb 2011
    Rep Power

    Default JPanel and JScrollPane inheritance

    I am having some issues with the implementation of the JScrollPane in my gui. I was wondering if anybody had any ideas?
    For my GUI i the following
    >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;
    >JPanel (nav bar)
    >JPanel (gridlayout dynamic based on house size)
    >>>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 :(

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Rep Power

Similar Threads

  1. problem positioning a JPanel in a JScrollPane
    By gib65 in forum AWT / Swing
    Replies: 5
    Last Post: 09-06-2013, 09:27 AM
  2. Adding jscrollpane when extending jpanel
    By phil128 in forum AWT / Swing
    Replies: 4
    Last Post: 01-19-2011, 12:30 AM
  3. Using Jscrollpane to move images on jpanel
    By Lazairus in forum New To Java
    Replies: 0
    Last Post: 12-06-2010, 03:46 PM
  4. JPanel/JScrollPane issue
    By Moncleared in forum New To Java
    Replies: 1
    Last Post: 09-23-2010, 05:02 AM
  5. Replies: 1
    Last Post: 05-09-2010, 07:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts