[英]Replacing a file tree component in Java Swing to another
我需要幫助使用 java swing 將 SB_Administrator.java 中 GUI 左側的虛擬文件樹替換為 FileTree.java 的更高級的 java 樹。
我目前在 Eclipse 中使用 windowBuilder。
在此先感謝您的幫助
SB_Administrator.java
// Get the root node of the tree
DefaultMutableTreeNode rootSess = (DefaultMutableTreeNode) tree.getModel().getRoot();
//rootSess.setUserObject(sess); // remember the Session in it
splitPane.setLeftComponent(tree);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
splitPane.setRightComponent(tabbedPane);
}
}
文件樹
………………………………………………………………………………………………………………………………………………………… ………………………………………………………………………………………………………………………………………………………… ………………………………………………………………………………………………………………………………………………………… ……………………………………………………………………………………………………………………………………………………………… ………………………………………………………………………………………………………………………………………………………… ………………………………………………………………………………………………………………………………………………………… …………………………………………………………………………………………………………………………………………
FileTree
對象File
對象作為參數(eq new File("root_path")
)splitPane.setLeftComponent(fileTree)
替換舊樹splitPane.setLeftComponent(tree)
splitPane.setLeftComponent(fileTree)
FileTree fileTree = new FileTree(new File("./"));
splitPane.setLeftComponent(fileTree);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.