Source:
<code>private void handleSnapshotEvent() throws NoCurrentCaseException, IOException { Case currentCase = Case.getCurrentCaseThrows(); Date generationDate = new Date(); final String defaultReportName = FileUtil.escapeFileName(currentCase.getDisplayName() + " " + new SimpleDateFormat("MMddyyyyHHmmss").format(generationDate)); final JTextField text = new JTextField(50); final JPanel panel = new JPanel(new GridLayout(2, 1)); panel.add(new JLabel(Bundle.VisualizationPane_fileName_prompt())); panel.add(text); text.setText(defaultReportName); <START> int result = JOptionPane.showConfirmDialog(graphComponent, panel, <END> Bundle.VisualizationPanel_action_dialogs_title(), JOptionPane.OK_CANCEL_OPTION); List<CommunicationsFilter.SubFilter> filters = currentFilter.getAndFilters(); if (result == JOptionPane.OK_OPTION) { String enteredReportName = text.getText(); String reportName = StringUtils.defaultIfBlank(enteredReportName, defaultReportName); Path reportPath = Paths.get(currentCase.getReportDirectory(), reportName); if (!Files.exists(reportPath)) { createReport(currentCase, reportName); } else { String message = String.format("Overwrite existing report?\n%s", reportName); result = JOptionPane.showConfirmDialog(graphComponent, message, Bundle.VisualizationPanel_action_dialogs_title(), JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.OK_OPTION) { FileUtil.deleteFileDir(reportPath.toFile()); createReport(currentCase, reportName); } } } }</code><technical_language>JOptionPane.showInoutDialog() here, eliminate GUI config code</technical_language>

Target:
private void handleSnapshotEvent() throws NoCurrentCaseException, IOException, TskCoreException { Case currentCase = Case.getCurrentCaseThrows(); Date generationDate = new Date(); final String defaultReportName = FileUtil.escapeFileName(currentCase.getDisplayName() + " " + new SimpleDateFormat("MMddyyyyHHmmss").format(generationDate)); final JTextField text = new JTextField(50); final JPanel panel = new JPanel(new GridLayout(2, 1)); panel.add(new JLabel(Bundle.VisualizationPane_fileName_prompt())); panel.add(text); text.setText(defaultReportName); int result = JOptionPane.showConfirmDialog(graphComponent, panel, Bundle.VisualizationPanel_action_dialogs_title(), JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.OK_OPTION) { String enteredReportName = text.getText(); if(enteredReportName.trim().isEmpty()){ result = JOptionPane.showConfirmDialog(graphComponent, Bundle.VisualizationPane_accept_defaultName(defaultReportName), Bundle.VisualizationPane_blank_report_title(), JOptionPane.OK_CANCEL_OPTION); if(result != JOptionPane.OK_OPTION) { return; } } String reportName = StringUtils.defaultIfBlank(enteredReportName, defaultReportName); Path reportPath = Paths.get(currentCase.getReportDirectory(), reportName); if (Files.exists(reportPath)) { result = JOptionPane.showConfirmDialog(graphComponent, Bundle.VisualizationPane_overrite_exiting(reportName), Bundle.VisualizationPanel_action_dialogs_title(), JOptionPane.OK_CANCEL_OPTION); if (result == JOptionPane.OK_OPTION) { FileUtil.deleteFileDir(reportPath.toFile()); createReport(currentCase, reportName); } } else { createReport(currentCase, reportName); currentCase.addReport(reportPath.toString(), Bundle.VisualizationPanel_module_name(), reportName); } } }