华人德语培训中心     Fahrschule Rainer     
显示结果从 1 到 2 共计 2 条
  1. #1
    高级会员 新生儿
    注册日期
    2007-03-15
    文章
    200
    Thanks
    0
    Thanked 1 Time in 1 Post
    声望力
    19

    预设 十万火急,请教一个java问题!!谢谢

    左边是jtree,右边是jeditorpane,希望实现点击jtree的节点在右边显示这个节点的名字
    比如点击jtree 的一个叶子:计算机,那么在右边也显示出这个string:计算机

    请问该如何实现?

    contentPane = new JEditorPane();
    contentPane.setEditable(false);

    displayText(TreeSelectionEvent e);//这句有错!!!!

    private void displayText(TreeSelectionEvent e) {
    TreePath path = e.getPath();
    String s = path.getLastPathComponent().toString();
    if (ideaTree!= null) {
    contentPane.setText("the content is: "+s);
    } else {
    contentPane.setText("nothing to displaythe content is");
    if (Error) {
    System.out.println("Attempted to display nothing");
    }
    }
    }

    请问到底该如何实现这个功能啊....急死了.....

  2. #2
    高级会员 幼儿园小班
    注册日期
    2007-10-20
    住址
    sorry
    文章
    522
    Thanks
    0
    Thanked 1 Time in 1 Post
    声望力
    19

    14 回复: 十万火急,请教一个java问题!!谢谢

    引用 作者: kkundcc 查看文章
    左边是jtree,右边是jeditorpane,希望实现点击jtree的节点在右边显示这个节点的名字
    比如点击jtree 的一个叶子:计算机,那么在右边也显示出这个string:计算机

    请问该如何实现?

    contentPane = new JEditorPane();
    contentPane.setEditable(false);

    displayText(TreeSelectionEvent e);//这句有错!!!!

    private void displayText(TreeSelectionEvent e) {
    TreePath path = e.getPath();
    String s = path.getLastPathComponent().toString();
    if (ideaTree!= null) {
    contentPane.setText("the content is: "+s);
    } else {
    contentPane.setText("nothing to displaythe content is");
    if (Error) {
    System.out.println("Attempted to display nothing");
    }
    }
    }

    请问到底该如何实现这个功能啊....急死了.....
    这算是简单的JAVA编程了,如果你人在维也纳,我可以有偿教你,不会不收你学费!
    走得再远学的再深也难圆Turing梦

主题讯息

目前查看此主题的会员

目前有1位用户正在查看此主题。(0 位会员和 1 游客)

发文规则

  • 不可以发表新主题
  • 不可以发表回复
  • 不可以上传附件
  • 不可以编辑自己的文章
  •