Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4851246

RFE: Potential speed improvement in JProgressBar

    XMLWordPrintable

    Details

    • Subcomponent:
    • Understanding:
      Fix Understood
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      Name: rmT116609 Date: 04/20/2003


      A DESCRIPTION OF THE REQUEST :
      The current implementation of the setValue method initially calls getModel which simply returns the model. The re-worked method would be:

      public void setValue(int n) {
          int oldValue = model.getValue();
          model.setValue(n);
       
          if (accessibleContext != null) {
              accessibleContext.firePropertyChange(
                  AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                  new Integer(oldValue),
                  new Integer(model.getValue()
              );
          }
      }

      JUSTIFICATION :
      This causes many calls to getModel which are not needed. I propose a change to just use the local member variable (called model).

      The call to getModel may be (possibly) a more way to access the model however if data hiding was the reason behind this choice perhaps the model shouldn't have been a member variable in the first place.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      A speed improvement
      (Review ID: 184477)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Imported:
              Indexed: