Groups
Groups
Sign in
Groups
Groups
Mac Widgets for Java
Conversations
About
Send feedback
Help
java.lang.NullPointerException in SourceListTreeUI after adding an item
9 views
Skip to first unread message
MacWidgetsUser
unread,
Aug 8, 2010, 12:13:11 PM
8/8/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Mac Widgets for Java
I get a NullPointerException after trying to add a SourceListItem
public void treeNodesInserted(TreeModelEvent e) {
TreePath path = e.getTreePath();
Object root = tree.getModel().getRoot();
TreePath pathToRoot = new TreePath(root);
if (path != null && path.getParentPath() != null
&&
path.getParentPath().getLastPathComponent().equals(root)
&& !tree.isExpanded(pathToRoot)) {
TreeUtils.expandPathOnEdt(tree, new
TreePath(root));
}
}
The Exception is thrown when tree.getModel().getRoot(); is called. The
tree seems to be null.
if(tree != null) {
Object root = tree.getModel().getRoot();
TreePath pathToRoot = new TreePath(root);
...
}
Fixes the issue.
I call the addItem after the whole ui is created.
Ken Orr
unread,
Aug 8, 2010, 6:42:29 PM
8/8/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Mac Widgets for Java
Hi Simon,
Make sure you're adding your items on the Event Dispatch Thread.
-Ken
On Aug 8, 9:13 am, MacWidgetsUser <
simon.buett...@googlemail.com
>
wrote:
MacWidgetsUser
unread,
Aug 9, 2010, 4:10:35 AM
8/9/10
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Mac Widgets for Java
Hi Ken,
thats exactly what i am doing. SwingUtilities.isEventDispatchThread()
is true
Reply all
Reply to author
Forward
0 new messages