8068301: [TEST_BUG] Test javax/swing/JColorChooser/Test4177735.java fails with ArrayIndexOutOfBoundsException with GTKL&F

Reviewed-by: alexsch, azvegint
This commit is contained in:
Shobhit Gupta 2015-01-30 13:27:33 +03:00 committed by Konstantin Shefov
parent 8717474863
commit 7c658a7610

@ -38,9 +38,20 @@ public class Test4177735 implements Runnable {
private static final long DELAY = 1000L;
public static void main(String[] args) throws Exception {
int hsvIndex = 0;
int panelsLength;
int finalIndex;
JColorChooser chooser = new JColorChooser();
AbstractColorChooserPanel[] panels = chooser.getChooserPanels();
chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[1] });
panelsLength = panels.length;
for(int i = 0; i < panelsLength; i++) {
if(panels[i].getDisplayName().equals("HSV")) {
hsvIndex = i;
}
}
finalIndex = Math.min(hsvIndex, panelsLength - 1);
chooser.setChooserPanels(new AbstractColorChooserPanel[] { panels[finalIndex] });
JDialog dialog = show(chooser);
pause(DELAY);