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

getTableCellRendererComponent crashes with Windows L&F on Vista

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • 6u10
    • client-libs

      The following code crashes on Vista when L&F is set to
      com.sun.java.swing.plaf.windows.WindowsLookAndFeel

      TableColumn column = jTable1.getColumnModel().getColumn(0);
      JTableHeader header = jTable1.getTableHeader();
      TableCellRenderer renderer = header.getDefaultRenderer();
      Component comp = renderer.getTableCellRendererComponent(null, column.getHeaderValue(), false, false, 0, 0);

      The following exception is thrown:

      java.lang.NullPointerException
              at sun.swing.table.DefaultTableCellHeaderRenderer.getColumnSortOrder(DefaultTableCellHeaderRenderer.java:113)
              at com.sun.java.swing.plaf.windows.WindowsTableHeaderUI$XPDefaultRenderer.getTableCellRendererComponent(WindowsTableHeaderUI.java:108)
              at tableuicrash.TableUICrashView.<init>(TableUICrashView.java:31)
              at tableuicrash.TableUICrashApp.startup(TableUICrashApp.java:35)
      ...


      This issue does not happen with other built-in L&Fs. For example, Metal and Nimbus work. From what I see in source code for the method in questions the issue is specific to "WindowsLookAndFeel.isOnVista()".

      java version "1.6.0_10"
      Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
      Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

      Please, see full sample in attachments.

            alexp Alexander Potochkin (Inactive)
            ppantele Petr Panteleyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: