@FXML
public void extractPDFOnClicked() {
Stage primaryStage = new Stage();
DirectoryChooser directoryChooser = new DirectoryChooser();
File selectedDirectory
= directoryChooser.showDialog(primaryStage);
if (selectedDirectory == null) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Warning");
alert.setHeaderText("Look, an Information Dialog");
alert.setContentText("You have not selected any directory!");
alert.show();
} else {
getTables(selectedDirectory.getAbsolutePath());
}
}
java类javafx.stage.DirectoryChooser的实例源码
AllocatedPATsController.java 文件源码
项目:SEGP_Group10
阅读 20
收藏 0
点赞 0
评论 0
Studentsinformation.java 文件源码
项目:SEGP_Group10
阅读 21
收藏 0
点赞 0
评论 0
/**
* When a user wants to extract the pdf file of the students information and
* when he clicks the button call goes to under given method and it
* generates the pdf file.
*/
@FXML
public void extractPDF() {
Stage primaryStage = new Stage();
DirectoryChooser directoryChooser = new DirectoryChooser();
File selectedDirectory
= directoryChooser.showDialog(primaryStage);
if (selectedDirectory == null) {
Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Warning");
alert.setHeaderText("Look, an Information Dialog");
alert.setContentText("You have not selected any directory!");
alert.show();
} else {
getTables(selectedDirectory.getAbsolutePath());
}
}
PromptUI.java 文件源码
项目:Gamma-Music-Manager
阅读 17
收藏 0
点赞 0
评论 0
/**
* Initial welcome prompt for first time startup. Browse button allows user
* to browse directories and choose a folder
*
* @return set directory for master panel
*/
public static String initialWelcome() {
Dialog dialog = makePlainDialog(WELCOME_TITLE, null, WELCOME_MESSAGE);
setLogoDialog(dialog);
ButtonType browse = new ButtonType("Browse");
dialog.getDialogPane().getButtonTypes().addAll(browse);
Optional<ButtonType> result = dialog.showAndWait();
if (result.isPresent() && result.get() == browse) {
DirectoryChooser directory = new DirectoryChooser();
File selectedFile = directory.showDialog(null);
if (selectedFile != null) {
return selectedFile.getAbsolutePath();
}
}
return null;
}
PromptUI.java 文件源码
项目:Gamma-Music-Manager
阅读 18
收藏 0
点赞 0
评论 0
/**
* Prompt to export a selected playlist
*
* @param playlists list of playlists
* @return selected playlist, null if prompt is canceled
*/
public static Pair<Playlist, File> exportPlaylist(List<Playlist> playlists) {
if(playlists.isEmpty()) {
customPromptError("Error", null, "Playlists not found");
return null;
}
ChoiceDialog<Playlist> dialog = new ChoiceDialog<>(playlists.get(0), playlists);
Stage stage = (Stage) dialog.getDialogPane().getScene().getWindow();
stage.getIcons().add(PROMPT_ICON);
dialog.setTitle(EXPORT_PLAYLIST_TITLE);
dialog.setHeaderText(EXPORT_PLAYLIST_HEADER);
setDialogIcon(dialog, "export-playlist.png");
dialog.setContentText(SELECT_PLAYLIST_LABEL);
Optional<Playlist> result = dialog.showAndWait();
if (result.isPresent()) {
DirectoryChooser directory = new DirectoryChooser();
File selectedFile = directory.showDialog(null);
if (selectedFile != null) {
return new Pair<>(result.get(), selectedFile);
}
}
return null;
}
WizardStartController.java 文件源码
项目:aptasuite
阅读 20
收藏 0
点赞 0
评论 0
/**
* Implements the logic for choosing the folder to server as the base path of the project
*/
@FXML
private void projectPathFileChooserActionButton() {
// Get the configuration file path
DirectoryChooser chooser = new DirectoryChooser();
chooser.setTitle("Choose the project location");
if (getDataModel().getProjectPath().isNotEmpty().get()) {
chooser.setInitialDirectory(new File(getDataModel().getProjectPath().get()));
}
File selectedDirectory = chooser.showDialog(null);
// Load configuration unless the user has chosen not to complete the dialog
if (selectedDirectory != null) {
projectPathTextField.setText(selectedDirectory.getAbsolutePath());
getDataModel().setLastSelectedDirectory(selectedDirectory);
}
}
JavaFxSelectionComponentFactory.java 文件源码
项目:triplea
阅读 17
收藏 0
点赞 0
评论 0
FolderSelector(final ClientSetting clientSetting) {
this.clientSetting = clientSetting;
final File initialValue = clientSetting.value().isEmpty() ? null : new File(clientSetting.value());
final HBox wrapper = new HBox();
textField = new TextField(clientSetting.value());
textField.prefColumnCountProperty().bind(Bindings.add(1, Bindings.length(textField.textProperty())));
textField.setMaxWidth(Double.MAX_VALUE);
textField.setDisable(true);
final Button chooseFileButton = new Button("...");
selectedFile = initialValue;
chooseFileButton.setOnAction(e -> {
final DirectoryChooser fileChooser = new DirectoryChooser();
if (selectedFile != null) {
fileChooser.setInitialDirectory(selectedFile);
}
final File file = fileChooser.showDialog(chooseFileButton.getScene().getWindow());
if (file != null) {
selectedFile = file;
textField.setText(file.toString());
}
});
wrapper.getChildren().addAll(textField, chooseFileButton);
getChildren().add(wrapper);
}
GenericChooser.java 文件源码
项目:spyfs
阅读 17
收藏 0
点赞 0
评论 0
public static GenericChooser newDirectoryC(){
return new GenericChooser() {
final DirectoryChooser ch = new DirectoryChooser();
@Override
public void setInitialDirectory(String initPath) {
fixPath(initPath, (f) -> ch.setInitialDirectory(f));
}
@Override
public void setTitle(String t) {
ch.setTitle(t);
}
@Override
public String show(final Window ownerWindow) {
return ch.showDialog(ownerWindow).getAbsolutePath();
}
};
}
CacheSuite.java 文件源码
项目:OS-Cache-Suite
阅读 16
收藏 0
点赞 0
评论 0
@Override
public void start(Stage stage) throws Exception {
environments = new ArrayList<CacheEnvironment>();
stage.setTitle("OSRS Cache Suite " + SuiteConstants.VERSION + "." + SuiteConstants.SUB_VERSION);
stage.setResizable(false);
Group rootGroup = new Group();
Scene scene = new Scene(rootGroup, SuiteConstants.WIDTH, SuiteConstants.HEIGHT);
cacheChooser = new DirectoryChooser();
VBox vertical = new VBox();
this.setupMenuBar(stage);
vertical.getChildren().add(bar);
setupTabPane(stage);
vertical.getChildren().add(tabPane);
rootGroup.getChildren().add(vertical);
stage.setScene(scene);
stage.show();
}
MenuController.java 文件源码
项目:LifeTiles
阅读 28
收藏 0
点赞 0
评论 0
/**
* Perform functionality associated with opening a file.
*
* @throws IOException
* throws <code>IOException</code> if any of the files were not
* found
*/
private void loadDataFiles() throws IOException {
DirectoryChooser directoryChooser = new DirectoryChooser();
directoryChooser.setTitle("Open folder containing data files");
Window window = menuBar.getScene().getWindow();
File directory = directoryChooser.showDialog(window);
// user aborted
if (directory == null) {
return;
}
loadGraph(directory);
loadTree(directory);
loadKnownMutations(directory);
loadAnnotations(directory);
loadMetaData(directory);
}
OptionStage.java 文件源码
项目:dm3270
阅读 18
收藏 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);
}
}