新书推介:《语义网技术体系》
作者:瞿裕忠,胡伟,程龚
   XML论坛     W3CHINA.ORG讨论区     >>计算机科学论坛<<     SOAChina论坛     Blog     开放翻译计划     新浪微博  
 
  • 首页
  • 登录
  • 注册
  • 软件下载
  • 资料下载
  • 核心成员
  • 帮助
  •   Add to Google

    >> 本版讨论Semantic Web(语义Web,语义网或语义万维网, Web 3.0)及相关理论,如:Ontology(本体,本体论), OWL(Web Ontology Langauge,Web本体语言), Description Logic(DL, 描述逻辑),RDFa,Ontology Engineering等。
    [返回] 计算机科学论坛W3CHINA.ORG讨论区 - Web新技术讨论『 Semantic Web(语义Web)/描述逻辑/本体 』 → 怎么根据xml文件的结构和数据建立树视图(用JAVA)???我是新手 查看新帖用户列表

      发表一个新主题  发表一个新投票  回复主题  (订阅本版) 您是本帖的第 2116 个阅读者浏览上一篇主题  刷新本主题   树形显示贴子 浏览下一篇主题
     * 贴子主题: 怎么根据xml文件的结构和数据建立树视图(用JAVA)???我是新手 举报  打印  推荐  IE收藏夹 
       本主题类别:     
     tian_20032242 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:14
      积分:92
      门派:XML.ORG.CN
      注册:2007/4/20

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给tian_20032242发送一个短消息 把tian_20032242加入好友 查看tian_20032242的个人资料 搜索tian_20032242在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看tian_20032242的博客楼主
    发贴心情 怎么根据xml文件的结构和数据建立树视图(用JAVA)???我是新手

    请各位高手指点,最好给出原代码

       收藏   分享  
    顶(0)
      




    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/4/23 11:58:00
     
     tian_20032242 帅哥哟,离线,有人找我吗?
      
      
      等级:大一新生
      文章:14
      积分:92
      门派:XML.ORG.CN
      注册:2007/4/20

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给tian_20032242发送一个短消息 把tian_20032242加入好友 查看tian_20032242的个人资料 搜索tian_20032242在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看tian_20032242的博客2
    发贴心情 
    谢谢拉
    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/4/23 11:59:00
     
     jpz6311whu 帅哥哟,离线,有人找我吗?
      
      
      
      威望:9
      等级:研三(收到微软亚洲研究院的Offer了)(版主)
      文章:1718
      积分:10610
      门派:W3CHINA.ORG
      注册:2005/4/12

    姓名:(无权查看)
    城市:(无权查看)
    院校:(无权查看)
    给jpz6311whu发送一个短消息 把jpz6311whu加入好友 查看jpz6311whu的个人资料 搜索jpz6311whu在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 引用回复这个贴子 回复这个贴子 查看jpz6311whu的博客3
    发贴心情 
    javax.swing
    Class JTree
    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JTree

    All Implemented Interfaces:
    ImageObserver, MenuContainer, Serializable, Accessible, Scrollable

    --------------------------------------------------------------------------------

    public class JTreeextends JComponentimplements Scrollable, Accessible

    A control that displays a set of hierarchical data as an outline. You can find task-oriented documentation and examples of using trees in How to Use Trees, a section in The Java Tutorial.

    A specific node in a tree can be identified either by a TreePath (an object that encapsulates a node and all of its ancestors), or by its display row, where each row in the display area displays one node. An expanded node is a non-leaf node (as identified by TreeModel.isLeaf(node) returning false) that will displays its children when all its ancestors are expanded. A collapsed node is one which hides them. A hidden node is one which is under a collapsed ancestor. All of a viewable nodes parents are expanded, but may or may not be displayed. A displayed node is both viewable and in the display area, where it can be seen.

    The following JTree methods use "visible" to mean "displayed":

    isRootVisible()
    setRootVisible()
    scrollPathToVisible()
    scrollRowToVisible()
    getVisibleRowCount()
    setVisibleRowCount()
    The next group of JTree methods use "visible" to mean "viewable" (under an expanded parent):

    isVisible()
    makeVisible()
    If you are interested in knowing when the selection changes implement the TreeSelectionListener interface and add the instance using the method addTreeSelectionListener. valueChanged will be invoked when the selection changes, that is if the user clicks twice on the same node valueChanged will only be invoked once.

    If you are interested in detecting either double-click events or when a user clicks on a node, regardless of whether or not it was selected, we recommend you do the following:

    final JTree tree = ...;

    MouseListener ml = new MouseAdapter() {
         public void mousePressed(MouseEvent e) {
             int selRow = tree.getRowForLocation(e.getX(), e.getY());
             TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
             if(selRow != -1) {
                 if(e.getClickCount() == 1) {
                     mySingleClick(selRow, selPath);
                 }
                 else if(e.getClickCount() == 2) {
                     myDoubleClick(selRow, selPath);
                 }
             }
         }
    };
    tree.addMouseListener(ml);

    NOTE: This example obtains both the path and row, but you only need to get the one you're interested in.
    To use JTree to display compound nodes (for example, nodes containing both a graphic icon and text), subclass TreeCellRenderer and use setCellRenderer(javax.swing.tree.TreeCellRenderer) to tell the tree to use it. To edit such nodes, subclass TreeCellEditor and use setCellEditor(javax.swing.tree.TreeCellEditor).

    Like all JComponent classes, you can use InputMap and ActionMap to associate an Action object with a KeyStroke and execute the action under specified conditions.

    Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder.

    点击查看用户来源及管理<br>发贴IP:*.*.*.* 2007/4/23 12:13:00
     
     GoogleAdSense
      
      
      等级:大一新生
      文章:1
      积分:50
      门派:无门无派
      院校:未填写
      注册:2007-01-01
    给Google AdSense发送一个短消息 把Google AdSense加入好友 查看Google AdSense的个人资料 搜索Google AdSense在『 Semantic Web(语义Web)/描述逻辑/本体 』的所有贴子 访问Google AdSense的主页 引用回复这个贴子 回复这个贴子 查看Google AdSense的博客广告
    2025/10/10 6:01:40

    本主题贴数3,分页: [1]

    管理选项修改tag | 锁定 | 解锁 | 提升 | 删除 | 移动 | 固顶 | 总固顶 | 奖励 | 惩罚 | 发布公告
    W3C Contributing Supporter! W 3 C h i n a ( since 2003 ) 旗 下 站 点
    苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
    78.125ms