为了账号安全,请及时绑定邮箱和手机立即绑定

java组件JTree问题

java组件JTree问题

陈鹏爱王敏 2017-06-25 18:09:39
//给树的子节点 添加了单机监听事件后,//怎么使其选择单机的节点页面置顶,以及单机的页面不论点击多少次,始终只实例化一次tree.addMouseListener(new MouseAdapter() {   public void mouseClicked(final MouseEvent arg0) {    TreePath tp = tree.getSelectionPath();    if( tp == null){     JOptionPane.showMessageDialog(null,        "请点击选择按钮");     return;     }    System.out.println(tp);    String str = tp.toString();    String[] arr = str.split(",");    str = arr[arr.length-1].trim();    str = str.substring(0, str.length()-1);    if(str.equals("开户")){          BankAddFrame addl = new BankAddFrame();     desktopPane.add(addl);         }else if(str.equals("挂失")){     BankLossFrame loss = new BankLossFrame();     desktopPane.add(loss);    }else if(str.equals("注销")){     BankCloseFrame close = new BankCloseFrame();     desktopPane.add(close);    }else if(str.equals("个人业务")){     BankPerFrame per = new BankPerFrame();     desktopPane.add(per);    }else if(str.equals("贷款")){     BankLoanFrame loan = new BankLoanFrame();     desktopPane.add(loan);    }      }  });
查看完整描述

目前暂无任何回答

  • 0 回答
  • 0 关注
  • 103 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信