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

JComboBox renderer called for invisible cells

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 1.4.0
    • 1.2.1
    • client-libs
    • beta
    • generic
    • generic

    Description



      Name: dbT83986 Date: 04/20/99


      When a JComboBox first drops down, the renderer is called for
      every element in the list, even those elements that will not
      actually be drawn on the screen. Constructing a
      "ListCellRendererComponent" can be a time-consuming operation,
      however. (You might need to access a database, scale fonts,
      etc.) This behavior unnecessarily lengthens the amount of time
      required to drop down the list as a consequence. To make matters
      worse, once a renderer component is requested for *every* cell,
      the combo box then requests to render components for the cells that
      it actually intends to display *again*. For example, if the list
      has 200 items in it and 10 will be displayed when the box drops
      down, renderers are requested for all 200 (including the first 10),
      then renderers are requested for the first 10 (again).

      Swing should only call getListCellRenderComponent for those cells
      that will actually appear on the screen when the combo box drops
      down, and Swing should only request these renderers only once
      during a give drop-down sequence. (Of course, you should re-render
      the cells the *second* time the list drops down in case something
      has changed.)
      (Review ID: 57232)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              mdavidsosunw Mark Davidson (Inactive)
              dblairsunw Dave Blair (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: