⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 向jtree中插入节点的例子 漂泊.htm

📁 行业分类数据库管理系统
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0051)http://blog.blogchina.com/article_51133.315937.html -->
<HTML><HEAD><TITLE>向Jtree中插入节点的例子 漂泊</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK 
href="向Jtree中插入节点的例子 漂泊.files/darkblue.css" type=text/css rel=stylesheet>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff>
<TABLE cellSpacing=5 cellPadding=5 width="100%" bgColor=#111133 border=0>
  <TBODY>
  <TR>
    <TD vAlign=center height=59>
      <H1><FONT color=#ffffff>&nbsp;[<A class=title title=回到首页 
      href="http://newwei2001.blogchina.com/">漂泊</A>]</FONT></H1></TD>
    <TD align=right width=120><A style="FONT-SIZE: 9pt" 
      href="http://blog.blogchina.com/" target=_blank><FONT 
      color=#ffffff>返回博客公社</FONT></A><BR><A style="FONT-SIZE: 9pt" 
      href="http://newwei2001.blogchina.com/"><FONT 
      color=#ffffff>返回我的博客</FONT></A><BR><A style="FONT-SIZE: 9pt" 
      onclick="javascript:window.external.AddFavorite('http://newwei2001.blogchina.com', '[漂泊]')" 
      href="http://blog.blogchina.com/article_51133.315937.html#" 
      target=_self><FONT color=#ffffff>添加到收藏夹</FONT></A> </TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
    <TD vAlign=top width=200 bgColor=#7b97b2>
      <TABLE cellSpacing=0 cellPadding=0 width=200 border=0>
        <TBODY>
        <TR>
          <TD vAlign=top width=200 bgColor=#000033><IMG height=1 hspace=0 
            src="向Jtree中插入节点的例子 漂泊.files/space.gif" width=1></TD></TR>
        <TR>
          <TD vAlign=top width=200 bgColor=#000033><IMG height=1 hspace=0 
            src="向Jtree中插入节点的例子 漂泊.files/space.gif" width=1></TD></TR>
        <TR>
          <TD vAlign=top bgColor=#7b97b2><IMG height=45 alt=最新发表文章 hspace=0 
            src="向Jtree中插入节点的例子 漂泊.files/nav_recent.gif" width=200> 
            <DIV id=left>
            <DIV class=side>
            <P><A 
            href="http://blog.blogchina.com/article_51133.630589.html">生成PDF文件的一个简单JAVA程序</A><BR><A 
            href="http://blog.blogchina.com/article_51133.579108.html">实现java1.4中的split()函数功能的代码</A><BR><A 
            href="http://blog.blogchina.com/article_51133.517977.html">java远程连接domino服务器</A><BR><A 
            href="http://blog.blogchina.com/article_51133.495556.html">bs上处理cookie的javascript代码</A><BR><A 
            href="http://blog.blogchina.com/article_51133.461920.html">Java基本数据类型转换</A><BR><A 
            href="http://blog.blogchina.com/article_51133.416307.html">幸福</A><BR><A 
            href="http://blog.blogchina.com/article_51133.351220.html">java写的把中文转换成全拼的程序</A><BR><A 
            href="http://blog.blogchina.com/article_51133.343825.html">爱情的年轮</A><BR><A 
            href="http://blog.blogchina.com/article_51133.339589.html">包头空难的内幕</A><BR><A 
            href="http://blog.blogchina.com/article_51133.332190.html">lotus注册用户邮箱的代理</A><BR></P></DIV></DIV></TD></TR>
        <TR>
          <TD vAlign=top width=200 bgColor=#000033><IMG height=1 hspace=0 
            src="向Jtree中插入节点的例子 漂泊.files/space.gif" width=1></TD></TR>
        <TR>
          <TD vAlign=top bgColor=#bdd1e4><IMG height=45 alt=文章归档 hspace=0 
            src="向Jtree中插入节点的例子 漂泊.files/nav_archive.gif" width=200> 
            <DIV id=left>
            <DIV class=side>
            <P><A 
            href="http://blog.blogchina.com/month.51133.200410.html">2004年10月 
            </A><BR><A 
            href="http://blog.blogchina.com/month.51133.200411.html">2004年11月 
            </A><BR><A 
            href="http://blog.blogchina.com/month.51133.200412.html">2004年12月 
            </A><BR><A 
            href="http://blog.blogchina.com/month.51133.200501.html">2005年1月 
            </A><BR></P></DIV>
            <FORM action=# method=get><INPUT type=hidden value=19 
            name=IncludeBlogs> <LABEL accessKey=4 
            for=search>本站搜索:</LABEL><BR><INPUT id=search size=13 
name=search><BR><INPUT type=submit value=搜索本blog> 
</FORM></DIV></TD></TR>
        <TR>
          <TD vAlign=top width=200 bgColor=#000033><IMG height=1 hspace=0 
            src="向Jtree中插入节点的例子 漂泊.files/space.gif" width=1></TD></TR>
        <TR>
          <TD vAlign=top bgColor=#7b97b2><IMG height=45 alt=链接资源 hspace=0 
            src="向Jtree中插入节点的例子 漂泊.files/nav_links.gif" width=200> 
            <DIV id=left>
            <DIV class=side>
            <P>友情链接<BR><A title="" 
            href="http://www.blogcn.com/user19/sunnyfry/index.html" 
            target=_blank>BLOG链接</A><BR><A title=程序员 href="http://www.csdn.net/" 
            target=_blank>程序员</A><BR></P></DIV></DIV></TD></TR>
        <TR>
          <TD vAlign=top width=200 bgColor=#000033><IMG height=1 hspace=0 
            src="向Jtree中插入节点的例子 漂泊.files/space.gif" width=1></TD></TR>
        <TR>
          <TD vAlign=top bgColor=#7b97b2><IMG height=45 alt=博客统计 hspace=0 
            src="向Jtree中插入节点的例子 漂泊.files/nav_statistics.gif" width=200> 
            <DIV id=left>
            <DIV class=side>
            <P>文章总数: 16 <BR>评论总数: 8 <BR></P></DIV>
            <DIV class=side>
            <P><STRONG>XML数据源 </STRONG></P></DIV>
            <DIV class=syndicate>
            <P><A class=nodecoration title="Link to the RSS 0.90 feed." 
            href="http://blog.blogchina.com/rss.php?blogId=51133&amp;profile=rss090"><IMG 
            src="向Jtree中插入节点的例子 漂泊.files/rss090_logo.gif" border=0></A><BR><A 
            class=nodecoration title="Link to the RSS 1.0 feed." 
            href="http://blog.blogchina.com/rss.php?blogId=51133&amp;profile=rss10" 
            )}?><IMG src="向Jtree中插入节点的例子 漂泊.files/rss10_logo.gif" 
            border=0></A><BR><A class=nodecoration 
            title="Link to the RSS 2.0 feed." 
            href="http://blog.blogchina.com/rss.php?blogId=51133&amp;profile=rss20"><IMG 
            src="向Jtree中插入节点的例子 漂泊.files/rss20_logo.gif" border=0></A><BR><A 
            class=nodecoration title="Link to the Atom 0.3 feed." 
            href="http://blog.blogchina.com/rss.php?blogId=51133&amp;profile=atom"><IMG 
            src="向Jtree中插入节点的例子 漂泊.files/atom_logo.png" border=0></A><BR></P><A 
            href="http://blog.blogchina.com/mcp/">管理入口</A> </DIV>
            <DIV class=powered>
            <P><A href="http://www.blogchina.com/" target=_blank><IMG 
            alt="powered by blogchina" 
            src="向Jtree中插入节点的例子 漂泊.files/poweredblogchina.gif" border=0></A> 
</P>
            <P><A class=powered title="Powered by BlogChina" 
            href="http://www.blogchina.com/" target=_blank>Powered by 
            BlogChina</A> 
      </P><BR></DIV><NOSCRIPT></NOSCRIPT></DIV></TD></TR></TBODY></TABLE></TD>
    <TD vAlign=top bgColor=#ffffff>
      <DIV class=content>
      <DIV class=dayheader>2004年 11月23日 </DIV>
      <DIV class=postheader><A name=315937></A>16 : 54 向Jtree中插入节点的例子 </DIV>
      <P>
      <P>java中向Jtree中插入节点的例子.</P>
      <P>去年用JAVA做图形化时的一个例子,思路不错!</P><FONT color=#333333>import 
      javax.swing.*;<BR>import javax.swing.event.*;<BR>import 
      javax.swing.tree.*;<BR>import java.awt.*;<BR>import java.awt.event.*; 
      </FONT>
      <P>public class Test extends JFrame {<BR>JTree tree = new 
      JTree();<BR>DefaultTreeModel model = 
      (DefaultTreeModel)tree.getModel();<BR>TreeSelectionModel selectionModel = 
      tree.getSelectionModel(); </P>
      <P>JButton removeButton = new JButton("Remove selected node");<BR>JButton 
      addButton = new JButton("Add node"); </P>
      <P>public Test() {<BR>Container contentPane = getContentPane(); </P>
      <P>selectionModel.setSelectionMode(<BR>TreeSelectionModel.SINGLE_TREE_SELECTION); 
      </P>
      <P>contentPane.add(new ControlPanel(), 
      BorderLayout.NORTH);<BR>contentPane.add(tree, BorderLayout.CENTER); </P>
      <P>tree.addTreeSelectionListener(<BR>new TreeSelectionListener() 
      {<BR>public void valueChanged(TreeSelectionEvent e) {<BR>TreePath path = 
      e.getNewLeadSelectionPath();<BR>boolean nodesAreSelected = (path != null); 
      </P>
      <P>addButton.setEnabled(nodesAreSelected);<BR>removeButton.setEnabled(nodesAreSelected);<BR>}<BR>});<BR>model.addTreeModelListener(new 
      TreeModelListener() {<BR>public void treeNodesInserted(TreeModelEvent e) 
      {<BR>showInsertionOrRemoval(e, " added to ");<BR>}<BR>public void 
      treeNodesRemoved(TreeModelEvent e) {<BR>showInsertionOrRemoval(e, " 
      removed from ");<BR>}<BR>private void 
      showInsertionOrRemoval(TreeModelEvent e,<BR>String s) {<BR>Object[] 
      parentPath = e.getPath();<BR>int[] indexes = 
      e.getChildIndices();<BR>Object[] children = e.getChildren();<BR>Object 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -