Skip to content
Snippets Groups Projects
Commit 2df1c924 authored by Simon Wang's avatar Simon Wang
Browse files

File structure on left pane and changes to directory when you open file

parent a6134e91
No related branches found
No related tags found
No related merge requests found
Pipeline #84120 passed
...@@ -8,14 +8,14 @@ import javafx.scene.layout.StackPane ...@@ -8,14 +8,14 @@ import javafx.scene.layout.StackPane
import java.io.File import java.io.File
class FolderView { class FolderView {
fun build() : StackPane { fun build(pathname: String = "src/main/kotlin") : StackPane {
val folder_img = ImageView(Image("https://png.pngtree.com/png-vector/20190916/ourmid/pngtree-folder-icon-for-your-project-png-image_1731079.jpg")) val folder_img = ImageView(Image("https://png.pngtree.com/png-vector/20190916/ourmid/pngtree-folder-icon-for-your-project-png-image_1731079.jpg"))
folder_img.fitWidth = 20.0 folder_img.fitWidth = 20.0
folder_img.fitHeight = 20.0 folder_img.fitHeight = 20.0
val folderIcon: Node = folder_img val folderIcon: Node = folder_img
val rootItem = TreeItem<Any?>("Inbox", folderIcon) val rootItem = TreeItem<Any?>("Inbox", folderIcon)
rootItem.isExpanded = true rootItem.isExpanded = true
File("src/main/kotlin").walk(FileWalkDirection.BOTTOM_UP).forEach { File(pathname).walk(FileWalkDirection.BOTTOM_UP).forEach {
val item = TreeItem<Any?>(it) val item = TreeItem<Any?>(it)
rootItem.children.add(item) rootItem.children.add(item)
} }
......
...@@ -52,7 +52,9 @@ class Main : Application() { ...@@ -52,7 +52,9 @@ class Main : Application() {
val status = HBox(label) val status = HBox(label)
// code for left pane // code for left pane
val left = VBox(Text("Left Pane")) val tree = FolderView().build()
val left = tree
left.prefWidth = 250.0
// code for right pane // code for right pane
val display_text = TextArea() val display_text = TextArea()
...@@ -62,7 +64,7 @@ class Main : Application() { ...@@ -62,7 +64,7 @@ class Main : Application() {
display_text.prefColumnCount = 200 display_text.prefColumnCount = 200
display_text.isEditable = false display_text.isEditable = false
val right = HBox(display_text) val right = HBox(display_text)
right.prefWidth = 750.0 right.prefWidth = 650.0
bold.setOnMouseClicked { bold.setOnMouseClicked {
var currentHighlight = text.selectedText var currentHighlight = text.selectedText
...@@ -153,7 +155,7 @@ class Main : Application() { ...@@ -153,7 +155,7 @@ class Main : Application() {
} catch (e: FileNotFoundException) { } catch (e: FileNotFoundException) {
e.printStackTrace(); e.printStackTrace();
} }
border.left = FolderView().build(selectedFile.parentFile.absolutePath)
} }
border.top = topContainer border.top = topContainer
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment