• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with handles in JTree

 
Velika Srbija
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It happens that when I click on the handle icon of the ancestor node, an Exception occurs:
java.lang.NullPointerException
What is goin' on?
----------------------------------
Here is code snippet:

void jTree1_valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)jTree1.getLastSelectedPathComponent();
Object birac = node.getUserObject();
TreePath niz = (TreePath)jTree1.getLeadSelectionPath();

jTextArea1.setText("");
if (jTree1.isVisible(niz)) {
if (node.isLeaf()) {
My_Class bt = (My_Class)birac;
String tabela1 = bt.getImeTabele();
if (qds1.isOpen()) {
try {
qds1.close();
} catch (Exception ex){} } //if
...
...
 
Antony Julian
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Srbija
You can use the following condition
If(<object> != null)
{
Your code;
}
Regards
Antony
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!