Java et Windows Look & feel

J'ai fait une application swing qui numérise les Images; et chaque Image est représentée par une feuille j'ai un arbre

le problème que j'ai rencontré est que jette cette exception

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.sun.java.swing.plaf.windows.XPStyle$Skin.getWidth(XPStyle.java:513)
at com.sun.java.swing.plaf.windows.XPStyle$Skin.getWidth(XPStyle.java:517)
at com.sun.java.swing.plaf.windows.WindowsTreeUI$ExpandedIcon.getIconWidth(WindowsTreeUI.java:138)
at javax.swing.plaf.basic.BasicTreeUI.drawCentered(BasicTreeUI.java:1580)
at javax.swing.plaf.basic.BasicTreeUI.paintExpandControl(BasicTreeUI.java:1464)
at javax.swing.plaf.basic.BasicTreeUI.paint(BasicTreeUI.java:1206)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:143)
at javax.swing.JComponent.paintComponent(JComponent.java:763)
at javax.swing.JComponent.paint(JComponent.java:1027)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5122)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:285)
at javax.swing.RepaintManager.paint(RepaintManager.java:1128)
at javax.swing.JComponent._paintImmediately(JComponent.java:5070)
at javax.swing.JComponent.paintImmediately(JComponent.java:4880)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:723)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:679)
at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:659)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

et je ne sais pas pourquoi cela s'affiche
Note: j'utilise Windows Regarder et se sentir

UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");

et java 1.6_22
sous windows 7

Vous pouvez poster votre code s'il vous plaît? Il est difficile de dire ce qui se passe sans le code.
Je ne crois pas que le problème est avec la bibliothèque elle-même. Avez-vous l'esprit de partager la façon dont vous êtes à la numérisation pour les images dans le répertoire. Je sens problème avec entrée. ( liste des images dir)
En fait, je ne pouvais croire que c'est un problème avec le Windows PL&F. Un exemple minimal de code qui déclenche le problème serait bon. Peut-être qu'il est tout à fait spécifique à l'appareil.
UIManager.setLookAndFeel("com.soleil.java.swing.plaf.de windows.WindowsLookAndFeel"); // Mauvais, Mauvais, Mauvais UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); // bon, bon, bon - Votre version ne fonctionne pas sur Windows, pas que les Mac et les utilisateurs d'Unix voulez voir Windows PLAF sur leur bureau, en tout cas. Quant à la suggestion de 'code postal' - I 'downvote'. Au lieu de poster un SSCCE (pscode.org/sscce.html). Aussi, mon LOUSTIC est que le code est en train de faire quelque chose de l'EDT, qui devrait être fait sur le EDT.
PLAF peut être modifié lorsqu'un JFrame (ou JApplet) est déjà visible. Il est juste nécessaire de faire appel à SwingUtilities.updateComponentTreeUI(Composant) pour assurer l'arbre de composants est ajusté.

OriginalL'auteur ehab refaat | 2011-03-01