diff --git a/src/main/java/cn/nightsoil/liveaudio/controller/IndexController.java b/src/main/java/cn/nightsoil/liveaudio/controller/IndexController.java index 2a22f5d..05b09dc 100644 --- a/src/main/java/cn/nightsoil/liveaudio/controller/IndexController.java +++ b/src/main/java/cn/nightsoil/liveaudio/controller/IndexController.java @@ -2,9 +2,12 @@ package cn.nightsoil.liveaudio.controller; import javafx.fxml.FXML; import javafx.scene.control.Button; -import javafx.scene.text.Text; +import javafx.scene.control.TextField; +import javafx.stage.DirectoryChooser; import org.springframework.stereotype.Controller; +import java.io.File; + /** * @author zhujh * @version 1.0 @@ -16,14 +19,21 @@ import org.springframework.stereotype.Controller; public class IndexController { @FXML - private Button helloButton; + private Button selectAudioFolder; @FXML - private Text messageText; + private TextField audioPathText; @FXML - private void sayHello() { - messageText.setText("Hello!"); + private void getAudioFolder() { + // 创建文件夹选择器 + DirectoryChooser directoryChooser = new DirectoryChooser(); + directoryChooser.setTitle("选择音频目录"); + + File selectAudioDir = directoryChooser.showDialog(audioPathText.getScene().getWindow()); + if (selectAudioDir != null) { + + } } } diff --git a/src/main/resources/views/index.fxml b/src/main/resources/views/index.fxml index d14511a..3851d91 100644 --- a/src/main/resources/views/index.fxml +++ b/src/main/resources/views/index.fxml @@ -7,7 +7,7 @@