swingx
  1. swingx
  2. SWINGX-364

JXTaskPaneContainer/JXTaskPane doesn't interact properly with JScrollPane

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.0
    • Fix Version/s: 0.9.1
    • Component/s: Misc Component
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      364

      Description

      I have a JScrollPane that contains a JXTaskPaneContainer that contains several
      JXTaskPanes. I dynamically add and remove tasks to the JXTaskPanes based on what
      my user is doing, however this causes the JXTaskPaneContainer to shrink or grow,
      and this isn't communicated to the enclosing JScrollPane so the scroll bar
      doesn't appear/disappear as required. Resizing the window gets everything back
      into sync.

      I've had a look at the code, and adding a 'revalidate' call and overriding 'add'
      in the JXTaskPane class to also call revalidate fixes the problem. I will attach
      a diff of my changes.

      Cheers
      Rob

        Activity

        Hide
        rasto1968 added a comment -

        Created an attachment (id=75)
        Patch to allow JXTaskPane to work properly inside a JScrollPane

        Show
        rasto1968 added a comment - Created an attachment (id=75) Patch to allow JXTaskPane to work properly inside a JScrollPane
        Hide
        kleopatra added a comment -


        assigned to the expert

        Show
        kleopatra added a comment - assigned to the expert
        Hide
        l2fprod added a comment -

        I had a similar issue report on my l2fprod component library (from which
        JXTaskPane comes). I did not a call to revalidate in the various add/remove
        methods but recommended users call revalidate when needed:
        http://common.l2fprod.com/articles/taskpane-dynamic.php

        I'm unclear whether adding calls to revalidate() in add/remove is a good
        practice, I never encountered it (yet) – even if JViewport (part of
        JScrollPane) does it...

        Show
        l2fprod added a comment - I had a similar issue report on my l2fprod component library (from which JXTaskPane comes). I did not a call to revalidate in the various add/remove methods but recommended users call revalidate when needed: http://common.l2fprod.com/articles/taskpane-dynamic.php I'm unclear whether adding calls to revalidate() in add/remove is a good practice, I never encountered it (yet) – even if JViewport (part of JScrollPane) does it...
        Hide
        rasto1968 added a comment -

        The JDK docs for JComponent revalidate state that 'This method will
        automatically be called on this component when a property value changes such
        that size, location, or internal layout of this component has been affected.
        This automatic updating differs from the AWT because programs generally no
        longer need to invoke validate to get the contents of the GUI to update.'

        So it would suggest that it should be automatic when the size of the component
        changes.

        Cheers
        Rob

        Show
        rasto1968 added a comment - The JDK docs for JComponent revalidate state that 'This method will automatically be called on this component when a property value changes such that size, location, or internal layout of this component has been affected. This automatic updating differs from the AWT because programs generally no longer need to invoke validate to get the contents of the GUI to update.' So it would suggest that it should be automatic when the size of the component changes. Cheers Rob
        Hide
        Karl Schaefer added a comment -

        Added revalidate to addImpl.

        Show
        Karl Schaefer added a comment - Added revalidate to addImpl.

          People

          • Assignee:
            l2fprod
            Reporter:
            rasto1968
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: