@Override public int showDialog(Component parent, String approveButtonText) throws HeadlessException { m_PanelBookmarks.reload(); return super.showDialog(parent, approveButtonText); }
/** * Displays the dialog. * * @param parent the parent component of the dialog; * can be <code>null</code> * @param approveButtonText the text of the <code>ApproveButton</code> * @return the return state of the file chooser on popdown * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @Override public int showDialog(Component parent, String approveButtonText) throws HeadlessException { m_PanelBookmarks.reload(); return super.showDialog(parent, approveButtonText); }
/** * Displays the dialog. * * @param parent the parent component of the dialog; * can be <code>null</code> * @param approveButtonText the text of the <code>ApproveButton</code> * @return the return state of the file chooser on popdown * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. * @see java.awt.GraphicsEnvironment#isHeadless */ @Override public int showDialog(Component parent, String approveButtonText) throws HeadlessException { m_PanelBookmarks.reload(); return super.showDialog(parent, approveButtonText); }
public void actionPerformed(ActionEvent e) { final FolderChooser chooser = new FolderChooser(); chooser.setDialogTitle("Input folder"); if (aoi.getInputFolder() != null) { File folder = new File(aoi.getInputFolder()); if (folder.exists()) { chooser.setSelectedFolder(folder); } } final Window window = SwingUtilities.getWindowAncestor((JComponent) e.getSource()); if (chooser.showDialog(window, "Select") == JFileChooser.APPROVE_OPTION) { File selectedFolder = chooser.getSelectedFolder(); inputFolderField.setText(selectedFolder.getAbsolutePath()); AOIManager.setLastInputPath(selectedFolder.getAbsolutePath()); } } });
public void actionPerformed(ActionEvent e) { final FolderChooser chooser = new FolderChooser(); chooser.setDialogTitle("Output folder"); if (aoi.getOutputFolder() != null) { File folder = new File(aoi.getOutputFolder()); if (folder.exists()) { chooser.setSelectedFolder(folder); } } final Window window = SwingUtilities.getWindowAncestor((JComponent) e.getSource()); if (chooser.showDialog(window, "Select") == JFileChooser.APPROVE_OPTION) { File selectedFolder = chooser.getSelectedFolder(); outputFolderField.setText(selectedFolder.getAbsolutePath()); AOIManager.setLastOutputPath(selectedFolder.getAbsolutePath()); } } });
@Override public void actionPerformed(ActionEvent e) { FolderChooser folderChooser = new FolderChooser(); folderChooser.setCurrentDirectory(new File(getDefaultOutputPath(appContext))); folderChooser.setDialogTitle("Select output directory"); folderChooser.setMultiSelectionEnabled(false); int result = folderChooser.showDialog(appContext.getApplicationWindow(), "Select"); /*I18N*/ if (result != JFileChooser.APPROVE_OPTION) { return; } File selectedFile = folderChooser.getSelectedFile(); setOutputDirPath(selectedFile.getAbsolutePath()); try { outputFileProperty.setValue(selectedFile); appContext.getPreferences().setPropertyString(LAST_OPEN_OUTPUT_DIR, selectedFile.getAbsolutePath()); } catch (ValidationException ve) { // not expected to ever come here appContext.handleError("Invalid input path", ve); } } });
private AbstractButton createOutputDirChooserButton(final Property outputFileProperty) { AbstractButton button = new JButton("..."); button.addActionListener(e -> { FolderChooser folderChooser = new FolderChooser(); folderChooser.setCurrentDirectory(new File(getDefaultOutputPath(appContext))); folderChooser.setDialogTitle("Select output directory"); folderChooser.setMultiSelectionEnabled(false); int result = folderChooser.showDialog(appContext.getApplicationWindow(), "Select"); /*I18N*/ if (result != JFileChooser.APPROVE_OPTION) { return; } File selectedFile = folderChooser.getSelectedFile(); setOutputDirPath(selectedFile.getAbsolutePath()); try { outputFileProperty.setValue(selectedFile); appContext.getPreferences().setPropertyString(PROPERTY_NAME_LAST_OPEN_OUTPUT_DIR, selectedFile.getAbsolutePath()); } catch (ValidationException ve) { // not expected to ever come here appContext.handleError("Invalid input path", ve); } }); return button; }