-
Enhancement
-
Resolution: Fixed
-
P4
-
8, 11, 17, 18, 19
-
b16
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8290624 | 17.0.5-oracle | Dukebot | P4 | Resolved | Fixed | b04 |
JDK-8291616 | 17.0.5 | Goetz Lindenmaier | P4 | Resolved | Fixed | b01 |
JDK-8290710 | 11.0.17-oracle | Dukebot | P4 | Resolved | Fixed | b03 |
JDK-8291618 | 11.0.17 | Goetz Lindenmaier | P4 | Resolved | Fixed | b01 |
JDK-8290766 | 8u351 | Dukebot | P4 | Resolved | Fixed | b04 |
Issue:
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.
Fix:
Introduced new API to JComboBox: get/setPrototypeDisplayValue(). This API allows the UI to calculate the display size using this prototype value rather than iterated over a large list of items. See RFE 4289100 which also addresses this problem.
Testing:
1. Tested in Mach5, 10 times per platform(macos,linux and windows) and got all pass.
2. Tested in JDK 1.3.0 and JDK 1.4.0 and the results are given below.
Java 1.3.0 -> Test Failed.
$ jdk1.3/bin/java JComboBoxPrototypeTest
getListCellRendererComponent index = -1, isSelected = false, cellHasFocus = false
Value of the Counter is 1
....
getListCellRendererComponent index = -1, isSelected = false, cellHasFocus = false
Value of the Counter is 101
Test Failed
java.lang.RuntimeException: Custom Renderer got called 101 times, expected is maximum 6 times
at JComboBoxPrototypeTestOld.main(JComboBoxPrototypeTest.java:107)
Java 1.4.0(added a call to setPrototypeDisplayValue()) -> Test Passed.
$ j2sdk1.4.0/bin/java JComboBoxPrototypeTest
getListCellRendererComponent index = -1, isSelected = false, cellHasFocus = false
Value of the Counter is 1
getListCellRendererComponent index = -1, isSelected = false, cellHasFocus = false
Value of the Counter is 2
getListCellRendererComponent index = -1, isSelected = false, cellHasFocus = false
Value of the Counter is 3
Test Passed
- backported by
-
JDK-8290624 Create an automated regression test for RFE 4231298
- Resolved
-
JDK-8290710 Create an automated regression test for RFE 4231298
- Resolved
-
JDK-8290766 Create an automated regression test for RFE 4231298
- Resolved
-
JDK-8291616 Create an automated regression test for RFE 4231298
- Resolved
-
JDK-8291618 Create an automated regression test for RFE 4231298
- Resolved
- relates to
-
JDK-4231298 JComboBox renderer called for invisible cells
- Resolved
-
JDK-4289100 JComboBox Needs a setFixedCellHeight Method
- Resolved
- links to
-
Commit openjdk/jdk11u-dev/fc4868ec
-
Commit openjdk/jdk17u-dev/488e6a35
-
Commit openjdk/jdk/6917c39e
-
Review openjdk/jdk11u-dev/1287
-
Review openjdk/jdk17u-dev/610
-
Review openjdk/jdk/7905