Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New method for getting a File #41

Open
SirMoM opened this issue May 23, 2019 · 0 comments
Open

New method for getting a File #41

SirMoM opened this issue May 23, 2019 · 0 comments

Comments

@SirMoM
Copy link
Owner

SirMoM commented May 23, 2019

final FileChooser fileChooser = new FileChooser();
			fileChooser.setTitle(new LangResourceManager().getLocaleString(LangResourceKeys.fileChooserCaption));
			fileChooser.getExtensionFilters().add(new ExtensionFilter(new LangResourceManager().getLocaleString(LangResourceKeys.csv_file), "*.csv"));

			try {
				fileChooser.setInitialDirectory(new File(PropertyManager.getProperty(PropertyFields.LAST_OPEND).toString()).getParentFile());
			} catch (final NullPointerException nullPointerException) {
				fileChooser.setInitialDirectory(new File(System.getProperty("user.home")));
			}

			// if the chooser is "x'ed" the file is null
			final File selectedFile = fileChooser.showOpenDialog(MainController.this.getStage().getScene().getWindow());
			if (selectedFile == null) {
				return;
			}

this is always the same so just put it in method in MC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant