怎么查找JTree节点,并展开它

重返春季 2010-01-29 11:47:55
我正在写一个解析pdm的工具,把表和列以JTree展示。现在需要做一个查找表功能,请问,谁有怎么查找JTree节点,并展开它类似的例子,十分感谢!
...全文
272 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wjj_cadn 2012-05-20
  • 打赏
  • 举报
回复
ei ,java SE 怎么做
ssssss 2010-02-01
  • 打赏
  • 举报
回复
AdminTree.html


<HTML>
<HEAD>
<TITLE></TITLE>
<LINK REL=stylesheet HREF="script/toc.css" TYPE="text/css">
<SCRIPT LANGUAGE="JavaScript" src="script/AdminTree.js"></script>
<STYLE TYPE='text/css'>
.level1 {margin-left:30;}
.level2 {display:none;margin-left:38;}
</STYLE>
</HEAD>
<BODY onload="init()" topmargin="0" leftmargin="0" rightmargin="0">
<DIV CLASS="level1" ID='head2Parent'>
<A class=OUTDENT href="" onclick='return expandIt("head2");'><IMG border=0 name=imEx src="images/arrowUp.gif" id=ttt> 用户管理</a>
</DIV>

<DIV CLASS="level2" ID='head2Child'>
<A href="UserList.jsp" id=ttt target=main><LI>用户列表</LI></a>
</DIV>

<DIV CLASS="level1" ID='head3Parent'>
<A class=OUTDENT href="" onclick='return expandIt("head3");' id=ttt><IMG border=0 height=13 name=imEx src="images/arrowUp.gif" width=17> 类别管理</a>
</DIV>

<DIV CLASS="level2" ID='head3Child'>
<A href="CategoryList.jsp" id=ttt target=main><LI>类别列表</LI></a>
<A href="CategoryListAJAX.jsp" id=ttt target=main><LI>类别列表AJAX</LI></a>
</DIV>

<DIV CLASS="level1" ID='head4Parent'>
<A class=OUTDENT href="" onclick='return expandIt("head4");' id=ttt><IMG border=0 height=13 name=imEx src="images/arrowUp.gif" width=17> 产品管理</a>
</DIV>

<DIV CLASS="level2" ID='head4Child'>
<A href="ProductList.jsp" id=ttt target=main><LI>产品列表</LI></a>
<A href="ProductSearch.jsp" id=ttt target=main><LI>产品搜索</LI></a>
</DIV>

<DIV CLASS="level1" ID='head6Parent'>
<A class=OUTDENT href="" onclick='return expandIt("head6");' id=ttt><IMG border=0 height=13 name=imEx src="images/arrowUp.gif" width=17> 订单管理</a>
</DIV>

<DIV CLASS="level2" ID='head6Child'>
<A href="OrderList.jsp" id=ttt target=main><LI>订单列表</LI></a>
</DIV>

<DIV CLASS="level1" ID='head7Parent'>
<A class=OUTDENT href="" onclick='return expandIt("head7");' id=ttt><IMG border=0 height=13 name=imEx src="images/arrowUp.gif" width=17> 统计分析</a>
</DIV>

<DIV CLASS="level2" ID='head7Child'>
<A href="../servlet/SalesCountServlet" id=ttt target=main><LI>销量统计</LI></a>
</DIV>

<DIV CLASS="level1" ID='head8Parent'>
<A class=OUTDENT href="" onclick='return expandIt("head8");' id=ttt><IMG border=0 height=13 name=imEx src="images/arrowUp.gif" width=17>留言管理</a>
</DIV>

<DIV CLASS="level2" ID='head8Child'>
<A href="MessageMan.jsp" id=ttt target=main><LI>留言</LI></a>
<A href="LiveWorkstation.jsp" id=ttt target=main><LI>直播工作站管理</LI></a>
</DIV>

</BODY>
</html>

不过很有可能不是你想要的效果
ssssss 2010-02-01
  • 打赏
  • 举报
回复
AdminTree.js

var isIE = true;
var imgUp = "images/arrowUp.gif" ;
var imgDn = "images/arrowDn.gif" ;
function expandIt( head, fExpandOnly )
{
//alert(!fExpandOnly);
var bulletImg ;
var allCol = "document." + ( isIE ? "all." : "" ) + head ;
var parentDiv = eval( allCol + "Parent" );
var childDiv = eval( allCol + "Child" );
if ( isIE )
{
if ( parentDiv )
bulletImg = parentDiv.children( 0 ).children( 'imEx' );
if ( childDiv )
{
if ( childDiv.style.display == "block" && (!fExpandOnly) )
{
childDiv.style.display = "none" ;
if ( bulletImg )
bulletImg.src = imgUp ;
}
else
{
childDiv.style.display = "block" ;
if ( bulletImg )
bulletImg.src = imgDn ;
}
}
}
else
{
if ( parentDiv )
bulletImg = parentDiv.document.images[ 'imEx' ];
if ( childDiv )
{
if ( childDiv.visibility == "hide" )
{
childDiv.visibility = "show" ;
if ( bulletImg )
bulletImg.src = imgDn ;
}
else if ( ! fExpandOnly )
{
childDiv.visibility = "hide";
if ( bulletImg )
bulletImg.src = imgUp ;
}
}
}
return false ; // cancels event
}

function doClick ( )
{
el = event.srcElement;
while ( el && el.tagName != "A" )
{
el = el.parentElement ;
}
if ( ! el ) return ;
if ( el.target != "main" ) return ;
hiliteSel( el );
}
var prevSel = null ;
function hiliteSel ( selLink )
{
var selColor = "red" ;
if ( prevSel )
{
prevSel.style.color = prevSel.prevColor ;
}
prevSel = selLink ;
prevSel.prevColor = selLink.style.color ;
selLink.style.color = selColor ;
}

function init() {
document.onclick = doClick ;
expandIt("head2");
//hiliteSel(ttt);
// parent.frames("Main").location.href = "/gtc/programMgr.html";
}

if ( screen.colorDepth > 8 )
{
// document.write( "<STYLE>BODY{background-image:url(/images/ai/tile_nav.jpg);}</STYLE>" );
}
var licenseID ='01-0006-0038-69648' ;
var pendingChanges =false ;
重返春季 2010-02-01
  • 打赏
  • 举报
回复
唉,怎么没有人回答呢?回答就给分!
道光2008 2010-01-29
  • 打赏
  • 举报
回复
上网找个

67,513

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧