JTree禁止雙擊Expand和Collapse的正常解決方法

stjauns1發表於2009-10-23
在中文網頁查詢的結果貌似非常複雜

查詢英文網頁結果見
[url]http://stackoverflow.com/questions/1223004/overriding-jtree-double-click-to-prevent-node-expansion[/url]

只需使用這個方法:
getCtree().setToggleClickCount(0);


此方法說明如下:
void javax.swing.JTree.setToggleClickCount(int clickCount)
Sets the number of mouse clicks before a node will expand or close. The default is two.

Since:
1.3
@beaninfo
bound: true description: Number of clicks before a node will expand/collapse.

相關文章