@FXML private void saveDirectory() {
try {
BetonQuestEditor instance = BetonQuestEditor.getInstance();
DirectoryChooser dc = new DirectoryChooser();
dc.setTitle(instance.getLanguage().getString("select-directory"));
File desktop = new File(System.getProperty("user.home") + File.separator + "Desktop");
if (desktop != null) dc.setInitialDirectory(desktop);
File selectedFile = dc.showDialog(instance.getPrimaryStage());
if (selectedFile != null) {
PackageSet set = BetonQuestEditor.getInstance().getDisplayedPackage().getSet();
set.saveToDirectory(selectedFile);
set.setSaveType(SaveType.DIR);
set.setFile(selectedFile);
MainMenuController.setSaveEnabled(true);
}
} catch (Exception e) {
ExceptionController.display(e);
}
}
java类javafx.stage.DirectoryChooser的实例源码
MainMenuController.java 文件源码
项目:BetonQuest-Editor
阅读 20
收藏 0
点赞 0
评论 0
Selection.java 文件源码
项目:FEFEditor
阅读 23
收藏 0
点赞 0
评论 0
private void openDialogue() {
DirectoryChooser chooser = new DirectoryChooser();
File file = chooser.showDialog(GuiData.getInstance().getStage());
if (file != null) {
try {
FileData.getInstance().setWorkingFile(file);
FXMLLoader loader = new FXMLLoader(FEFEditor.class.getResource("gui/fxml/fates/Dialogue.fxml"));
content = loader.load();
changeContent();
Dialogue controller = loader.getController();
controller.addAccelerators();
} catch (IOException e) {
e.printStackTrace();
}
}
}
IndirectSound.java 文件源码
项目:FEFEditor
阅读 17
收藏 0
点赞 0
评论 0
@FXML
private void addCharacter() {
DirectoryChooser chooser = new DirectoryChooser();
File file = chooser.showDialog(GuiData.getInstance().getStage());
if (file != null) {
TextInputDialog dialog = new TextInputDialog("placeholder");
dialog.setTitle("Name Input");
dialog.setHeaderText("Name Input");
dialog.setContentText("Please enter the voice set name:");
Optional<String> result = dialog.showAndWait();
result.ifPresent(name -> bin.addEntries(name, file));
entryList.getItems().clear();
groupList.getItems().clear();
selectedEntry = null;
selectedGroup = null;
for (VoiceGroup v : bin.getEntries()) {
groupList.getItems().add(v.getMainLabel());
}
}
}
MainGuiController.java 文件源码
项目:OpenDiabetes
阅读 20
收藏 0
点赞 0
评论 0
private static DirectoryChooser configureDirectoryChooser(File initDir) {
// fileChooser.setTitle("View Pictures");
DirectoryChooser dirChooser = new DirectoryChooser();
if (initDir != null && initDir.exists()) {
if (initDir.isDirectory()) {
dirChooser.setInitialDirectory(initDir);
} else {
dirChooser.setInitialDirectory(initDir.getParentFile());
}
} else {
dirChooser.setInitialDirectory(
new File(System.getProperty("user.home")));
}
return dirChooser;
}
SimpleWebServer.java 文件源码
项目:marathonv5
阅读 22
收藏 0
点赞 0
评论 0
@Override public void start(Stage primaryStage) throws Exception {
primaryStage.setTitle("Simple Web Server");
BorderPane root = new BorderPane();
TextArea area = new TextArea();
root.setCenter(area);
ToolBar bar = new ToolBar();
Button openInBrowser = FXUIUtils.createButton("open-in-browser", "Open in External Browser", true);
openInBrowser.setOnAction((event) -> {
try {
Desktop.getDesktop().browse(URI.create(webRoot));
} catch (IOException e) {
e.printStackTrace();
}
});
Button changeRoot = FXUIUtils.createButton("fldr_closed", "Change Web Root", true);
changeRoot.setOnAction((event) -> {
DirectoryChooser chooser = new DirectoryChooser();
File showDialog = chooser.showDialog(primaryStage);
if (showDialog != null)
server.setRoot(showDialog);
});
bar.getItems().add(openInBrowser);
bar.getItems().add(changeRoot);
root.setTop(bar);
System.setOut(new PrintStream(new Console(area)));
System.setErr(new PrintStream(new Console(area)));
area.setEditable(false);
primaryStage.setScene(new Scene(root));
primaryStage.setOnShown((e) -> startServer(getParameters().getRaw()));
primaryStage.show();
}
DirectoryChooserSample.java 文件源码
项目:marathonv5
阅读 27
收藏 0
点赞 0
评论 0
@Override public void start(final Stage stage) {
stage.setTitle("Directory Chooser Sample");
final DirectoryChooser directoryChooser = new DirectoryChooser();
final Button openButton = new Button("Select a folder...");
openButton.setOnAction((final ActionEvent e) -> {
File file = directoryChooser.showDialog(stage);
if (file != null) {
openFile(file);
}
});
final GridPane inputGridPane = new GridPane();
GridPane.setConstraints(openButton, 0, 1);
inputGridPane.setHgap(6);
inputGridPane.setVgap(6);
inputGridPane.getChildren().addAll(openButton);
final Pane rootGroup = new VBox(12);
rootGroup.getChildren().addAll(inputGridPane);
rootGroup.setPadding(new Insets(12, 12, 12, 12));
stage.setScene(new Scene(rootGroup));
stage.show();
}
EvaluatorHandler.java 文件源码
项目:ReqMan
阅读 25
收藏 0
点赞 0
评论 0
public void exportAllGroups() {
LOGGER.traceEntry();
if (!isCatalogueLoaded()) {
LOGGER.debug(":exportAllGroups - No catalogue set. Returning");
return;
}
DirectoryChooser dc = new DirectoryChooser();
if (manager.hasLastExportLocation()) {
dc.setInitialDirectory(manager.getLastExportLocation());
}
dc.setTitle("Choose an export folder");
File dir = dc.showDialog(evaluator.getScene().getWindow());
for (Group g : manager.groupList()) {
assemble(g);
}
manager.exportAllGroups(dir);
}
Helper.java 文件源码
项目:Parallator
阅读 32
收藏 0
点赞 0
评论 0
public static File showDirectoryChooser(Scene scene) {
String home = System.getProperty("user.home");
File[] downloads = {
new File(home + "/Downloads/"),
new File(home + "/Загрузки/"),
new File(home)
};
DirectoryChooser fileChooser = new DirectoryChooser();
for (File download : downloads) {
if (download.exists()) {
fileChooser.setInitialDirectory(download);
break;
}
}
return fileChooser.showDialog(scene.getWindow());
}
InstallLocation.java 文件源码
项目:OneClient
阅读 17
收藏 0
点赞 0
评论 0
public static void getInstallDir(Predicate<File> predicate) throws IOException {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
URL fxmlUrl = classLoader.getResource("gui/install_location.fxml");
if (fxmlUrl == null) {
OneClientLogging.logger.error("An error has occurred loading the fxml!");
}
FXMLLoader fxmlLoader = new FXMLLoader();
fxmlLoader.setLocation(fxmlUrl);
fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
Parent root = fxmlLoader.load(fxmlUrl.openStream());
Stage stage = new Stage();
stage.setTitle("Select Install Location");
stage.getIcons().add(new Image("images/icon.png"));
stage.setResizable(false);
stage.initOwner(Main.stage);
stage.initModality(Modality.WINDOW_MODAL);
Scene scene = new Scene(root, 500, 150);
scene.getStylesheets().add("gui/css/theme.css");
stage.setScene(scene);
stage.show();
InstallLocation controller = fxmlLoader.getController();
controller.okButton.setOnAction(event -> {
predicate.test(new File(controller.locationField.getText()));
stage.close();
});
controller.browseButton.setOnAction(event -> {
DirectoryChooser directoryChooser = new DirectoryChooser();
File dir = new File(controller.locationField.getText());
if (dir.exists())
directoryChooser.setInitialDirectory(dir);
File selectedDirectory = directoryChooser.showDialog(stage);
if (selectedDirectory != null) {
controller.locationField.setText(selectedDirectory.getAbsolutePath());
}
});
controller.locationField.setText(Constants.getDefaultDir().getAbsolutePath());
}
AudioController.java 文件源码
项目:main_carauto_board
阅读 21
收藏 0
点赞 0
评论 0
private void pickAndReadAudioFilesFromFolder(final Stage primaryStage, final VBox vboxPlaylist) {
final DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle("Find a folder with audio files");
final File selectedDirectory = directoryChooser.showDialog(primaryStage);
if (selectedDirectory != null) {
final File[] listFiles = selectedDirectory.listFiles();
if (listFiles != null) {
LOGGER.info("Found " + listFiles.length + " files");
Arrays.stream(listFiles)
.filter(file -> !file.isDirectory())
.filter(file -> {
final String extension = FilenameUtils.getExtension(file.getPath());
return extension.equals(MP3) || extension.equals(M4A);
})
.forEach(file -> {
LOGGER.info("Trying to load from the file: " + file.getPath());
try {
readFileAndSetInitialStateForAudioItem(file, vboxPlaylist);
} catch (IOException e) {
e.printStackTrace();
}
});
}
}
}
MainWindowController.java 文件源码
项目:RNGames
阅读 35
收藏 0
点赞 0
评论 0
/**
* Open a DirectoryChooser window.
*/
@FXML
private void handleSelectFolder() {
final DirectoryChooser chooser = new DirectoryChooser();
chooser.setTitle(Locale.getString("directory.chooser.title")); //$NON-NLS-1$
if (!this.textAreaSaveDirectory.getText().isEmpty()) {
final File defaultDirectory = new File(this.textAreaSaveDirectory.getText());
if (defaultDirectory.exists()) {
chooser.setInitialDirectory(defaultDirectory);
}
}
final File selectedDirectory = chooser.showDialog(this.app.getPrimaryStage());
if (selectedDirectory != null) {
this.textAreaSaveDirectory.setText(selectedDirectory.toString());
}
}
PacketCaptureController.java 文件源码
项目:project-cars-replay-enhancer-ui
阅读 17
收藏 0
点赞 0
评论 0
@FXML
private void selectStorageDirectory() {
Stage stage = (Stage) root.getScene().getWindow();
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle("Open Telemetry Storage Directory");
directoryChooser.setInitialDirectory(
new File(System.getProperty("user.home")));
File directory = directoryChooser.showDialog(stage);
if (directory != null && directory.isDirectory()) {
try {
String directoryName = directory.getCanonicalPath();
txtStorageDirectory.setText(directoryName);
} catch (IOException e) {
e.printStackTrace();
}
}
}
DialogUtil.java 文件源码
项目:Gargoyle
阅读 27
收藏 0
点赞 0
评论 0
public static File showDirSaveDialog(Window ownerWindow, File initDir, Consumer<DirectoryChooser> option) {
DirectoryChooser chooser = new DirectoryChooser();
chooser.setInitialDirectory(initDir);
chooser.setTitle("Directory");
if (option != null)
option.accept(chooser);
File selectedDir = chooser.showDialog(ownerWindow);
if (selectedDir != null && selectedDir.exists()) {
applyLastPath(selectedDir);
}
return selectedDir;
}
ExportDialog.java 文件源码
项目:travelimg
阅读 24
收藏 0
点赞 0
评论 0
private void handleBrowse(Event event) {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle("Export Ort wählen");
if (exportFolder != null) {
directoryChooser.setInitialDirectory(new File(exportFolder));
}
File directory = directoryChooser.showDialog(null);
if (directory == null || !directory.exists()) {
getLogger().info("Invalid directory selected.");
return;
}
directoryField.setText(directory.getPath());
exportFolder = directory.getPath();
}
ChooseDirectoryPane.java 文件源码
项目:pattypan
阅读 18
收藏 0
点赞 0
评论 0
/**
* Opens directory chooser
*/
private void chooseAndSetDirectory() {
DirectoryChooser fileChooser = new DirectoryChooser();
fileChooser.setTitle(Util.text("choose-directory-window-name"));
Session.DIRECTORY = !Settings.getSetting("path").isEmpty()
? new File(Settings.getSetting("path"))
: null;
fileChooser.setInitialDirectory(Session.DIRECTORY);
File file;
try {
file = fileChooser.showDialog(stage);
} catch (IllegalArgumentException ex) {
fileChooser.setInitialDirectory(null);
file = fileChooser.showDialog(stage);
}
if (file != null) {
Session.DIRECTORY = file;
browsePath.setText(file.getAbsolutePath());
Settings.setSetting("path", Session.DIRECTORY.getAbsolutePath());
getFileListByDirectory(file);
}
}
MenuController.java 文件源码
项目:zest-writer
阅读 28
收藏 0
点赞 0
评论 0
@FXML private void handleSwitchWorkspaceAction(ActionEvent event) throws IOException{
DirectoryChooser fileChooser = new DirectoryChooser();
fileChooser.setInitialDirectory(MainApp.getDefaultHome());
fileChooser.setTitle(Configuration.getBundle().getString("ui.dialog.switchworkspace"));
File selectedDirectory = fileChooser.showDialog(MainApp.getPrimaryStage());
if(selectedDirectory!=null) {
MainApp.getConfig().setWorkspacePath(selectedDirectory.getAbsolutePath());
MainApp.getConfig().loadWorkspace();
Alert alert = new CustomAlert(AlertType.INFORMATION);
alert.setTitle(Configuration.getBundle().getString("ui.options.workspace"));
alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.workspace.header"));
alert.setContentText(Configuration.getBundle().getString("ui.dialog.workspace.text") + " " + MainApp.getConfig().getWorkspacePath());
alert.setResizable(true);
alert.showAndWait();
}
}
MenuController.java 文件源码
项目:zest-writer
阅读 18
收藏 0
点赞 0
评论 0
@FXML private void handleExportMarkdownButtonAction(ActionEvent event){
Content content = mainApp.getContent();
DirectoryChooser fileChooser = new DirectoryChooser();
fileChooser.setInitialDirectory(MainApp.getDefaultHome());
fileChooser.setTitle(Configuration.getBundle().getString("ui.dialog.export.dir.title"));
File selectedDirectory = fileChooser.showDialog(MainApp.getPrimaryStage());
File selectedFile = new File(selectedDirectory, ZdsHttp.toSlug(content.getTitle()) + ".md");
log.debug("Tentative d'export vers le fichier " + selectedFile.getAbsolutePath());
if(selectedDirectory != null){
content.saveToMarkdown(selectedFile);
log.debug("Export réussi vers " + selectedFile.getAbsolutePath());
Alert alert = new CustomAlert(AlertType.INFORMATION);
alert.setTitle(Configuration.getBundle().getString("ui.dialog.export.success.title"));
alert.setHeaderText(Configuration.getBundle().getString("ui.dialog.export.success.header"));
alert.setContentText(Configuration.getBundle().getString("ui.dialog.export.success.text")+" \"" + selectedFile.getAbsolutePath() + "\"");
alert.setResizable(true);
alert.showAndWait();
}
}
OpenContent.java 文件源码
项目:zest-writer
阅读 20
收藏 0
点赞 0
评论 0
@FXML public void handleOpenButtonAction() {
DirectoryChooser chooser = new DirectoryChooser();
chooser.setTitle(Configuration.getBundle().getString("ui.menu.dialog.content.open.title"));
File defaultDirectory;
if(MainApp.getConfig().getWorkspaceFactory() == null){
MainApp.getConfig().loadWorkspace();
}
defaultDirectory = new File(MainApp.getZdsutils().getOfflineContentPathDir());
chooser.setInitialDirectory(defaultDirectory);
File selectedDirectory = chooser.showDialog(MainApp.getPrimaryStage());
if(selectedDirectory != null){
File manifest = new File(selectedDirectory.getAbsolutePath() + File.separator + "manifest.json");
ObjectMapper mapper = new ObjectMapper();
Content content;
try{
content = mapper.readValue(manifest, Content.class);
content.setRootContent(content, selectedDirectory.getAbsolutePath());
mainApp.setContent(content);
openContentWindow.close();
}catch(IOException e){
MainApp.getLogger().error(e.getMessage(), e);
}
}
}
OptionStage.java 文件源码
项目:xframium-java
阅读 16
收藏 0
点赞 0
评论 0
private void editLocation ()
{
DirectoryChooser chooser = new DirectoryChooser ();
chooser.setTitle ("Choose Spy Folder");
File currentLocation = spyFolder.isEmpty () ? null : new File (spyFolder);
if (currentLocation != null && currentLocation.exists ())
chooser.setInitialDirectory (currentLocation);
File selectedDirectory = chooser.showDialog (this);
if (selectedDirectory != null)
{
spyFolder = selectedDirectory.getAbsolutePath ();
fileComboBox.getItems ().clear ();
ObservableList<String> files = getSessionFiles (spyFolder);
fileComboBox.setItems (files);
if (files.size () > 0)
fileComboBox.getSelectionModel ().select (0);
}
}
Mp3ImportController.java 文件源码
项目:amperfi
阅读 19
收藏 0
点赞 0
评论 0
@Override
public void handle(ActionEvent event) {
DirectoryChooser dc = new DirectoryChooser();
dc.setTitle("Choose directory to import from");
File directory = dc.showDialog(Amperfi.ui.getWindow());
if(directory == null) return;
Amperfi.db.addFolder(directory.getAbsolutePath()); // TODO Check for duplicate/invalid folder
Amperfi.ui.mp3Import.reloadFolders();
TaskSyncFolders task = new TaskSyncFolders(directory);
Amperfi.ui.mp3ImportProgress.btnCancel.setOnAction(action -> task.cancel());
new Thread(task).start();
Amperfi.ui.mp3ImportProgress.pbImporting.progressProperty().bind(task.progressProperty());
Amperfi.ui.mp3ImportProgress.lblPath.textProperty().bind(task.messageProperty());
}
GitemberServiceImpl.java 文件源码
项目:gitember
阅读 18
收藏 0
点赞 0
评论 0
public void createRepo(final Consumer<String> onOk) {
final DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setInitialDirectory(new File(GitemberApp.getSettingsService().getUserHomeFolder()));
final File selectedDirectory =
directoryChooser.showDialog(GitemberApp.getMainStage());
if (selectedDirectory != null) {
String absPath = selectedDirectory.getAbsolutePath();
try {
GitemberApp.getRepositoryService().createRepository(absPath);
String repoPath = absPath + File.separator + Const.GIT_FOLDER;
log.log(Level.INFO, "New repository was created - " + absPath);
onOk.accept(repoPath);
} catch (Exception e) {
log.log(Level.SEVERE, "Cannot create repository", e);
GitemberApp.showException("Cannot create repository", e);
}
}
}
FXMLController.java 文件源码
项目:gitember
阅读 27
收藏 0
点赞 0
评论 0
/**
* Open repository.
*
* @param actionEvent event
* @throws Exception
*/
public void openHandler(ActionEvent actionEvent) throws Exception {
DirectoryChooser directoryChooser = new DirectoryChooser();
if (GitemberApp.getSettingsService().getLastProject() != null) {
directoryChooser.setInitialDirectory(new File(GitemberApp.getSettingsService().getLastProject()));
}
File selectedDirectory =
directoryChooser.showDialog(GitemberApp.getMainStage());
if (selectedDirectory != null) {
String absPath = selectedDirectory.getAbsolutePath();
if (!absPath.endsWith(Const.GIT_FOLDER)) {
absPath += File.separator + Const.GIT_FOLDER;
}
openRepository(absPath);
}
createOpenRecentMenu();
}
App.java 文件源码
项目:xltsearch
阅读 28
收藏 0
点赞 0
评论 0
@FXML
private void openFolder() {
if (catalog.get().isIndexing()) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Confirmation");
alert.setHeaderText("Indexing in progress");
alert.setContentText("Opening a new folder will cancel indexing. Continue?");
Optional<ButtonType> result = alert.showAndWait();
// escape on cancel/close
if (!result.isPresent() || result.get() != ButtonType.OK) {
return;
}
}
DirectoryChooser directoryChooser = new DirectoryChooser();
File dir = directoryChooser.showDialog(stage);
if (dir != null) {
if (catalog.get() != null) {
catalog.get().close();
}
catalog.set(new Catalog(dir));
} // do nothing on cancel
}
MainController.java 文件源码
项目:KorgPackage
阅读 24
收藏 0
点赞 0
评论 0
public void exportChunkAction() {
Chunk chunk = (Chunk) chunksListView.getSelectionModel().getSelectedItem();
if (chunk != null) {
// FileChooser fileChooser = new FileChooser();
// fileChooser.setTitle("Save File");
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setInitialDirectory(lastFileChooserPath);
directoryChooser.setTitle("Choose directory");
File dir = directoryChooser.showDialog(stage);
if (dir != null) {
try {
lastFileChooserPath = dir;
ObservableList<Chunk> chunks = chunksListView.getSelectionModel().getSelectedItems();
for (Chunk c : chunks) {
c.export(dir.getPath());
}
} catch (IOException e) {
System.err.println(e.getMessage());
}
}
}
}
ImageUtilsCheckDialogController.java 文件源码
项目:komplexni-validator
阅读 17
收藏 0
点赞 0
评论 0
private void selectImageUtilPath(String property, File defaultDir, ImageUtil util, MyListener listener) {
DirectoryChooser chooser = new DirectoryChooser();
chooser.setTitle(String.format("Vyberte adresář se spustitelnými soubory %s", util.getUserFriendlyName()));
File currentDir = getConfigurationManager().getFileOrNull(property);
if (currentDir != null && currentDir.exists()) {
chooser.setInitialDirectory(currentDir);
} else if (defaultDir != null && defaultDir.exists()) {
chooser.setInitialDirectory(defaultDir);
}
File selectedDirectory = chooser.showDialog(stage);
if (selectedDirectory != null) {
getConfigurationManager().setFile(property, selectedDirectory);
main.getValidationDataManager().getImageUtilManager().setPath(util, selectedDirectory);
listener.onFinished();
}
}
PspValidationConfigurationDialogController.java 文件源码
项目:komplexni-validator
阅读 16
收藏 0
点赞 0
评论 0
public void selectPspDir(ActionEvent actionEvent) {
DirectoryChooser chooser = new DirectoryChooser();
chooser.setTitle("Vyberte kořenový adresář PSP balíku");
File lastPspDir = getConfigurationManager().getFileOrNull(ConfigurationManager.PROP_LAST_PSP_DIR);
if (lastPspDir != null && lastPspDir.exists()) {
File parent = lastPspDir.getParentFile();
if (parent != null && parent.exists()) {
chooser.setInitialDirectory(parent);
}
}
File selectedDir = chooser.showDialog(stage);
if (selectedDir != null) {
getConfigurationManager().setFile(ConfigurationManager.PROP_LAST_PSP_DIR, selectedDir);
try {
pspDirTextField.setText(selectedDir.getCanonicalPath());
} catch (IOException e) {
//should never happen
throw new RuntimeException(e);
}
}
}
MainFX.java 文件源码
项目:Krothium-Launcher
阅读 22
收藏 0
点赞 0
评论 0
/**
* Selects a game directory for the profile editor
*/
@FXML private void selectGameDirectory() {
DirectoryChooser chooser = new DirectoryChooser();
if (this.gameDir.getText().isEmpty()) {
chooser.setInitialDirectory(Constants.APPLICATION_WORKING_DIR);
} else {
File gd = new File(this.gameDir.getText());
if (gd.isDirectory()) {
chooser.setInitialDirectory(gd);
} else {
chooser.setInitialDirectory(Constants.APPLICATION_WORKING_DIR);
}
}
File selectedFolder = chooser.showDialog(null);
if (selectedFolder != null) {
this.gameDir.setText(selectedFolder.getAbsolutePath());
}
}
CertImportController.java 文件源码
项目:certmgr
阅读 20
收藏 0
点赞 0
评论 0
@SuppressWarnings("unused")
@FXML
void onCmdChooseDirectorySource(ActionEvent evt) {
DirectoryChooser chooser = new DirectoryChooser();
chooser.setInitialDirectory(this.preferenceInitalDirectory.getValueAsFile());
File directorySource = chooser.showDialog(getUI());
if (directorySource != null) {
this.ctlDirectorySourceInput.setText(directorySource.getAbsolutePath());
this.preferenceInitalDirectory.putValueFromFile(directorySource);
syncPreferences();
validateAndReloadDirectorySource();
}
}
PlayConfigurationView.java 文件源码
项目:beatoraja
阅读 19
收藏 0
点赞 0
评论 0
@FXML
public void addSongPath() {
DirectoryChooser chooser = new DirectoryChooser();
chooser.setTitle("楽曲のルートフォルダを選択してください");
File f = chooser.showDialog(null);
if (f != null) {
boolean unique = true;
for (String path : bmsroot.getItems()) {
if (path.equals(f.getPath()) || f.getPath().startsWith(path + File.separatorChar)) {
unique = false;
break;
}
}
if (unique) {
bmsroot.getItems().add(f.getPath());
}
}
}
FileContextMenu.java 文件源码
项目:Maus
阅读 20
收藏 0
点赞 0
评论 0
public static void getFileContextMenu(HBox fileIcon, String fileName, MouseEvent e, ClientObject client) {
ContextMenu cm = new ContextMenu();
MenuItem sb1 = new MenuItem("Delete File");
MenuItem sb2 = new MenuItem("Download File");
sb2.setOnAction(event -> {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle("Select download location");
File selectedDirectory =
directoryChooser.showDialog(Maus.getPrimaryStage());
FileContextMenu.selectedDirectory = selectedDirectory.getAbsolutePath();
try {
client.clientCommunicate("DOWNLOAD");
client.clientCommunicate(fileName);
} catch (IOException e1) {
Logger.log(Level.ERROR, e1.toString());
}
});
cm.getItems().addAll(sb1, sb2);
cm.show(fileIcon, e.getScreenX(), e.getScreenY());
}