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

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

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

Similar Threads

  1. problem positioning a JPanel in a JScrollPane
    By gib65 in forum AWT / Swing
    Replies: 5
    Last Post: 09-06-2013, 08:27 AM
  2. Adding jscrollpane when extending jpanel
    By phil128 in forum AWT / Swing
    Replies: 4
    Last Post: 01-18-2011, 11:30 PM
  3. Using Jscrollpane to move images on jpanel
    By Lazairus in forum New To Java
    Replies: 0
    Last Post: 12-06-2010, 02:46 PM
  4. JPanel/JScrollPane issue
    By Moncleared in forum New To Java
    Replies: 1
    Last Post: 09-23-2010, 04:02 AM
  5. Replies: 1
    Last Post: 05-09-2010, 06: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
  •