FULL PRODUCT VERSION : java version "1.6.0-beta" Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-beta-b59g) Java HotSpot(TM) Client VM (build 1.6.0-beta-b59g, mixed mode, sharing) ADDITIONAL OS VERSION INFORMATION : Microsoft Windows XP [Version 5.1.2600] EXTRA RELEVANT SYSTEM CONFIGURATION : Must have Windows Plus! themes installed. (Or other theming software.) A DESCRIPTION OF THE PROBLEM : Running an Swing application on Microsoft Windows XP (and using the XP look and feel), with an alternate "theme" installed, produces an exception when displaying a JTable. See also these various reports of the problem using Java applications: http://forum.java.sun.com/thread.jspa?threadID=667836&tstart=0 http://idendev.com/SCRIPTS/WA-motorola.EXE?A2=ind0507&L=sdklist&T=0&P=8587 http://tamino.forums.softwareag.com/viewtopic.php?p=16756& http://jalbum.net/forum/thread.jspa?threadID=1475&messageID=8836 http://www.google.com/search?q=NullPointerException+emptyborder STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : 1. You must get a Windows XP system with Microsoft Plus! installed. Switch to one of the custom themes. http://www.microsoft.com/windows/plus/PlusHome.asp 2. Run the SwingSet2 demo 3. Change Look and Feel to "Windows Style Look and Feel" 4. Click on the JTable demo EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - Expected table header to render as usual. ACTUAL - Stacktrace originating in WindowsTableHeaderUI.XPDefaultRenderer. It seems that in this line: setBorder(new EmptyBorder(skin.getContentMargin())); skin.getContentMargin() is returning null, and EmptyBorder doesn't like that. ERROR MESSAGES/STACK TRACES THAT OCCUR : java.lang.NullPointerException at javax.swing.border.EmptyBorder.<init>(Unknown Source) at com.sun.java.swing.plaf.windows.WindowsTableHeaderUI$XPDefaultRenderer.ge= tTableCellRendererComponent(Unknown Source) at javax.swing.plaf.basic.BasicTableHeaderUI.getHeaderRenderer(Unknown Source) at javax.swing.plaf.basic.BasicTableHeaderUI.getHeaderHeight(Unknown Source) at javax.swing.plaf.basic.BasicTableHeaderUI.createHeaderSize(Unknown Source) at javax.swing.plaf.basic.BasicTableHeaderUI.getPreferredSize(Unknown Source) at javax.swing.JComponent.getPreferredSize(Unknown Source) at javax.swing.ViewportLayout.preferredLayoutSize(Unknown Source) at java.awt.Container.preferredSize(Unknown Source) at java.awt.Container.getPreferredSize(Unknown Source) at javax.swing.JComponent.getPreferredSize(Unknown Source) at javax.swing.ScrollPaneLayout.layoutContainer(Unknown Source) at java.awt.Container.layout(Unknown Source) at java.awt.Container.doLayout(Unknown Source) at java.awt.Container.validateTree(Unknown Source) REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- N/A - SwingSet demo provides adequate example ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : User workarounds: 1. Change from XP custom look and feel to standard XP or Windows Classic L&F 2. Change application properties to "Run this program in compatibility mode for Windows 2000." Code workarounds: No way to workaround without modifying Swing code. But one of these things could be corrected: 1. ThemeReader.getThemeMargins(..) guarantees to return non-null 2. Skin.getContentMargin() guarantees to return non-null 3. XPDefaultRenderer's call to getContentMargin() should handle null and pass in some legit Insets to EmptyBorder.
|