Olá pessoal,
Estou utilizando JTree e o look and feel nimbus.
A aplicacao tem a necessidade de percorrer a tree selecionando cada um dos nós, de tempos em tempos.
Para isso, em determinado momento da aplicação preciso aplicar o comando scrollPathToVisible() na JTree. Este comando serve para correr o scrollpane para o nó que vai ser selecionado caso ele não esteja visível. Por exemplo, se eu tenho uma tree com 50 nós em uma tela pequena, nem todos os nós estarão visíveis ao mesmo tempo, para isso antes de selecionar o nó este comando o deixa visível.
O problema é que quando é aplicado este comando usando o look and feel nimbus (scrollPathToVisible) ocorre o seguinte erro:
java.lang.NullPointerException
at com.sun.java.swing.plaf.nimbus.NimbusIcon.paintIcon(NimbusIcon.java:40)
at sun.swing.plaf.synth.SynthIcon.paintIcon(SynthIcon.java:47)
at javax.swing.plaf.synth.SynthTreeUI$ExpandedIconWrapper.paintIcon(SynthTreeUI.java:771)
at sun.swing.plaf.synth.SynthIcon.paintIcon(SynthIcon.java:47)
at javax.swing.plaf.synth.SynthTreeUI.drawCentered(SynthTreeUI.java:621)
at javax.swing.plaf.basic.BasicTreeUI.paintExpandControl(BasicTreeUI.java:1464)
at javax.swing.plaf.synth.SynthTreeUI.paintExpandControl(SynthTreeUI.java:610)
at javax.swing.plaf.synth.SynthTreeUI.paint(SynthTreeUI.java:357)
at javax.swing.plaf.synth.SynthTreeUI.update(SynthTreeUI.java:226)
at javax.swing.JComponent.paintComponent(JComponent.java:763)
at javax.swing.JComponent.paint(JComponent.java:1029)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5124)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:278)
at javax.swing.RepaintManager.paint(RepaintManager.java:1220)
at javax.swing.JComponent.paintForceDoubleBuffered(JComponent.java:1065)
at javax.swing.JViewport.paintView(JViewport.java:1633)
at javax.swing.JViewport.windowBlitPaint(JViewport.java:1564)
at javax.swing.JViewport.setViewPosition(JViewport.java:1118)
at javax.swing.JViewport.scrollRectToVisible(JViewport.java:415)
at javax.swing.JComponent.scrollRectToVisible(JComponent.java:3065)
at javax.swing.JTree.scrollPathToVisible(JTree.java:2095)
Gostaria de uma ajuda com este problema, pois não estou conseguindo achar uma solução.
Desde já,
Obrigado.