Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > NullPointerException in BasicTreeUI.isToggleEvent

Reply
Thread Tools

NullPointerException in BasicTreeUI.isToggleEvent

 
 
Nick Gusev
Guest
Posts: n/a
 
      06-17-2004
Just in case if somebody need it. I didn't find this anywhere. If you
are getting after invoking JTree.updateUI something like:

java.lang.NullPointerException
at javax.swing.plaf.basic.BasicTreeUI.completeEditing (BasicTreeUI.java:1880)
at javax.swing.plaf.basic.BasicTreeUI$TreeSelectionHa ndler.valueChanged(BasicTreeUI.java:2496)
at javax.swing.tree.DefaultTreeSelectionModel.fireVal ueChanged(DefaultTreeSelectionModel.java:629)
at javax.swing.tree.DefaultTreeSelectionModel.notifyP athChange(DefaultTreeSelectionModel.java:1076)
at javax.swing.tree.DefaultTreeSelectionModel.setSele ctionPaths(DefaultTreeSelectionModel.java:287)
at javax.swing.tree.DefaultTreeSelectionModel.setSele ctionPath(DefaultTreeSelectionModel.java:170)
at javax.swing.JTree.setSelectionPath(JTree.java:1168 )
at javax.swing.plaf.basic.BasicTreeUI.selectPathForEv ent(BasicTreeUI.java:2192)

all you need to know that it's bad idea to update UI in order to
refresh a tree. All pending events will be for old UI with tree ==
null. JTree.updateUI replaces UI with new one from UIManager and calls
JTree.invalidate. So just call JTree.invalidate instead. This should
solve the problem.
 
Reply With Quote
 
 
 
 
Thomas Weidenfeller
Guest
Posts: n/a
 
      06-18-2004
Nick Gusev wrote:
> all you need to know that it's bad idea to update UI in order to
> refresh a tree.


Often a need for refreshing a tree arises if the model is not firing the
necessary change events. Instead of torturing the innocent JTree widget
you might want to check your model implementation and behavior and fix
it if needed.

/Thomas
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
!s.equals("") returns nullPointerException ??? Tom Java 12 08-05-2003 02:16 PM
LinkedList NullPointerException occurs after switched from IBM JVM 1.4.0 to 1.4.1 Tohru Kao Java 3 07-14-2003 08:12 AM
Re: java.lang.NullPointerException (Tomcat) Dhek Bhun Kho Java 0 07-08-2003 11:53 PM
LinkedList NullPointerException occurs after switched from IBM JVM 1.4.0 to 1.4.1 Tohru Kao Java 1 07-08-2003 09:09 AM
Re: NullPointerException Error?? Jon A. Cruz Java 0 07-06-2003 04:27 AM



Advertisments