-
Enhancement
-
Resolution: Fixed
-
P4
-
1.2.1
-
beta
-
generic
-
generic
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)
======================================================================
- relates to
-
JDK-8283493 Create an automated regression test for RFE 4231298
- Resolved