JTree 隐藏根时看不到展开树图标

JTree cannot see expand tree icons when hiding root

当我创建一个JTree并调用setRootVisible(false)时,我看不到小树的打开图标,我仍然可以双击节点展开它,但在第一层看不到它们。有什么想法吗?

看来你需要打电话给 setShowsRootHandles(true),才能看到它们。