test/jdk/javax/swing/JTableHeader/8020039/TableHeaderRendererExceptionTest.java
changeset 49090 82c1fe23c469
parent 47216 71c04702a3d5
equal deleted inserted replaced
49089:149647adb633 49090:82c1fe23c469
     1 /*
     1 /*
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    20  * or visit www.oracle.com if you need additional information or have any
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 import javax.swing.UIManager;
    24 import javax.swing.UIManager;
       
    25 import javax.swing.UnsupportedLookAndFeelException;
    25 import javax.swing.table.JTableHeader;
    26 import javax.swing.table.JTableHeader;
    26 
    27 
    27 /**
    28 /**
    28  * @test
    29  * @test
    29  * @summary Tests whether getTableCellRendererComponent() method handles
    30  * @summary Tests whether getTableCellRendererComponent() method handles
    38         UIManager.LookAndFeelInfo[] lookAndFeelArray
    39         UIManager.LookAndFeelInfo[] lookAndFeelArray
    39                 = UIManager.getInstalledLookAndFeels();
    40                 = UIManager.getInstalledLookAndFeels();
    40 
    41 
    41         for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
    42         for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
    42             String lookAndFeelString = lookAndFeelItem.getClassName();
    43             String lookAndFeelString = lookAndFeelItem.getClassName();
    43 
    44             try{
    44             UIManager.setLookAndFeel(lookAndFeelString);
    45                 UIManager.setLookAndFeel(lookAndFeelString);
       
    46             } catch (final UnsupportedLookAndFeelException ignored) {
       
    47                 continue;
       
    48             }
    45 
    49 
    46             // Test getTableCellRendererComponent method by passing null table
    50             // Test getTableCellRendererComponent method by passing null table
    47             JTableHeader header = new JTableHeader();
    51             JTableHeader header = new JTableHeader();
    48 
    52 
    49             header.getDefaultRenderer().getTableCellRendererComponent(null,
    53             header.getDefaultRenderer().getTableCellRendererComponent(null,