List of usage examples for javax.swing JFileChooser setDialogTitle
@BeanProperty(preferred = true, description = "The title of the JFileChooser dialog window.") public void setDialogTitle(String dialogTitle)
JFileChooser
window's title bar. From source file:openlr.mapviewer.coding.ui.LoadConfigButtonListener.java
@Override public void actionPerformed(final ActionEvent e) { JFileChooser chooser = fileChooserFactory.createFileChooser(FILE_CHOOSER_TOPIC_CODING_PROPERTIES); chooser.setFileFilter(new XmlOrPropertiesFileFilter()); String codingTypeString = codeOptionsDialog.getCodingType().name().toLowerCase(); chooser.setDialogTitle("Select " + codingTypeString + " properties file"); int re = chooser.showOpenDialog(null); if (re == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); try {/* ww w . ja va 2 s .c om*/ FileConfiguration config = OpenLRPropertiesReader.loadPropertiesFromFile(file); this.codeOptionsDialog.setValues(config); } catch (OpenLRPropertyException e1) { WrappedLabelLookAlikeTextArea mapNameArea = new WrappedLabelLookAlikeTextArea(1, NR_COLUMNS_ERROR_TEXT_FIELD); mapNameArea.setText("Error reading the " + codingTypeString + " properties! " + e1); mapNameArea.setPreferredSize(PREFERRED_SIZE_ERROR_TEXT_FIELD); JOptionPane.showMessageDialog(null, mapNameArea, "Properties error", JOptionPane.ERROR_MESSAGE); } } }
From source file:openlr.mapviewer.coding.ui.SaveConfigButtonListener.java
@Override public void actionPerformed(final ActionEvent e) { JFileChooser chooser = fileChooserFactory.createFileChooser(FILE_CHOOSER_TOPIC_DECODER_PROPERTIES); String codingTypeString = codeOptionsDialog.getCodingType().name().toLowerCase(); chooser.setDialogTitle("Select the file to save the " + codingTypeString + " properties to"); int re = chooser.showSaveDialog(codeOptionsDialog); if (re == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); if (writePermitted(file)) { applyChangesActionListener.applyChanges(); FileConfiguration currentConfig = codingPropertiesHolder .getProperties(codeOptionsDialog.getCodingType()); try { currentConfig.save(file); } catch (ConfigurationException e1) { JOptionPane.showMessageDialog(null, "Could not write the properties to file " + file.getAbsolutePath() + ". " + e1, "Write error", JOptionPane.ERROR_MESSAGE); }/* w w w . j a v a2s. com*/ } } }
From source file:org.apache.cayenne.modeler.dialog.db.merge.MergerOptions.java
/** * Allows user to save generated SQL in a file. *//*from w ww . j a v a2 s. c o m*/ public void storeSQLAction() { JFileChooser fc = new JFileChooser(); fc.setDialogType(JFileChooser.SAVE_DIALOG); fc.setDialogTitle("Save SQL Script"); Resource projectDir = getApplication().getProject().getConfigurationResource(); if (projectDir != null) { fc.setCurrentDirectory(new File(projectDir.getURL().getPath())); } if (fc.showSaveDialog(getView()) == JFileChooser.APPROVE_OPTION) { refreshGeneratorAction(); try { File file = fc.getSelectedFile(); FileWriter fw = new FileWriter(file); PrintWriter pw = new PrintWriter(fw); pw.print(textForSQL); pw.flush(); pw.close(); } catch (IOException ex) { reportError("Error Saving SQL", ex); } } }
From source file:org.apache.cayenne.modeler.dialog.pref.ClasspathPreferences.java
protected void chooseClassEntry(FileFilter filter, String title, int selectionMode) { JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(selectionMode); chooser.setDialogType(JFileChooser.OPEN_DIALOG); chooser.setAcceptAllFileFilterUsed(true); getLastDirectory().updateChooser(chooser); if (filter != null) { chooser.addChoosableFileFilter(filter); }/* w w w. ja va 2 s . c o m*/ chooser.setDialogTitle(title); File selected = null; int result = chooser.showOpenDialog(view); if (result == JFileChooser.APPROVE_OPTION) { selected = chooser.getSelectedFile(); } if (selected != null) { if (!classPathEntries.contains(selected.getAbsolutePath())) { // store last dir in preferences getLastDirectory().updateFromChooser(chooser); int len = classPathEntries.size(); int key = ++counter; String value = selected.getAbsolutePath(); addChangedPreferences(Integer.toString(key), value); classPathEntries.add(value); classPathKeys.add(Integer.toString(key)); tableModel.fireTableRowsInserted(len, len); } } }
From source file:org.apache.uima.tools.docanalyzer.DBAnnotationViewerDialog.java
/** * If the current AE filename is not know ask for it. Then parse the selected file and return the * AnalysisEngineDescription object.//from www . ja va 2 s . c om * * @return the selected AnalysisEngineDescription, null if the user cancelled */ protected AnalysisEngineDescription promptForAE() throws IOException, InvalidXMLException, ResourceInitializationException { if (med1.getTAEfile() != null) { File taeFile = new File(med1.getTAEfile()); XMLInputSource in = new XMLInputSource(taeFile); AnalysisEngineDescription aed = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(in); return aed; } else { String taeDir = med1.getTAEfile(); JFileChooser chooser = new JFileChooser(taeDir); chooser.setDialogTitle("Select the Analysis Engine that Generated this Output"); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); int returnVal = chooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { XMLInputSource in = new XMLInputSource(chooser.getSelectedFile()); return UIMAFramework.getXMLParser().parseAnalysisEngineDescription(in); } else { return null; } } }
From source file:org.colombbus.tangara.CommandSelection.java
private JFileChooser createFileChooser() { String title;/*from w w w.j a v a 2 s.c o m*/ FileFilter fileFilter; if (mode == MODE_PROGRAM_CREATION) { title = Messages.getString("CommandSelection.programCreation.save.title"); fileFilter = createTangaraFileFilter(); } else { title = Messages.getString("CommandSelection.fileCreation.save.title"); fileFilter = createTextFileFilter(); } JFileChooser fileChooser = new JFileChooser(myParent.getCurrentDirectory()); fileChooser.setDialogTitle(title); fileChooser.addChoosableFileFilter(fileFilter); return fileChooser; }
From source file:org.docwhat.iated.ui.PreferencesDialog.java
private void browseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonActionPerformed JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Please select your editor"); chooser.setCurrentDirectory(new File(getDefaultAppDirectory())); chooser.setFileFilter(new FileFilter() { public boolean accept(File f) { if (OS.isFamilyMac() && f.isDirectory() && f.getName().toLowerCase().endsWith(".app")) { return (true); }// www .jav a2s. c om return f.canExecute(); } public String getDescription() { return "Applications"; } }); int result = chooser.showOpenDialog(this); if (result == JFileChooser.APPROVE_OPTION) { editorField.setText(chooser.getSelectedFile().getPath()); } }
From source file:org.domainmath.gui.MainFrame.java
/** * Save script as another name./*from w ww . ja v a2s . c o m*/ */ public void saveScriptAs() { JFileChooser fc = new JFileChooser(); fc.setMultiSelectionEnabled(false); fc.setDialogTitle("Save As"); int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { String oldfile = fileTab.getToolTipTextAt(fileTab.getSelectedIndex()); save(fc.getSelectedFile(), fileTab.getSelectedIndex()); this.removeFileNameFromList(oldfile); fileTab.setToolTipTextAt(fileTab.getSelectedIndex(), fc.getSelectedFile().getAbsolutePath()); this.addFileNameToList(fc.getSelectedFile().getAbsolutePath()); } }
From source file:org.domainmath.gui.MainFrame.java
public void saveHistoryAs() { JFileChooser fc = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter("M-Files (*.m)", "m"); fc.setCurrentDirectory(new File(System.getProperty("user.dir") + File.separator + "works")); fc.setFileFilter(filter);/* www. j a v a 2 s . c o m*/ fc.setMultiSelectionEnabled(false); fc.setDialogTitle("Save As"); File file_save; int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { String path = fc.getSelectedFile().getAbsolutePath(); if (!path.endsWith(".m")) { file_save = new File(fc.getSelectedFile().getAbsolutePath() + ".m"); saveHistory(file_save); } else { file_save = new File(fc.getSelectedFile().getAbsolutePath() + ".m"); saveHistory(file_save); } } }
From source file:org.eurocarbdb.application.glycoworkbench.plugin.s3.Cockpit.java
/** * Event handler for this application, handles all menu items. *//*from ww w . j a v a2 s . com*/ public void actionPerformed(ActionEvent event) { // Service Menu Events if ("LoginEvent".equals(event.getActionCommand())) { loginEvent(null); } else if ("LogoutEvent".equals(event.getActionCommand())) { logoutEvent(); } else if (event.getActionCommand() != null && event.getActionCommand().startsWith("LoginSwitch")) { String loginName = event.getActionCommand().substring("LoginSwitch:".length()); AWSCredentials awsCredentials = (AWSCredentials) loginAwsCredentialsMap.get(loginName); loginEvent(awsCredentials); } else if ("QuitEvent".equals(event.getActionCommand())) { System.exit(0); } // Bucket Events. else if ("ViewBucketProperties".equals(event.getActionCommand())) { listBucketProperties(); } else if ("RefreshBuckets".equals(event.getActionCommand())) { listAllBuckets(); } else if ("CreateBucket".equals(event.getActionCommand())) { createBucketAction(); } else if ("DeleteBucket".equals(event.getActionCommand())) { deleteSelectedBucket(); } else if ("ManageDistributions".equals(event.getActionCommand())) { S3Bucket[] buckets = bucketTableModel.getBuckets(); String[] bucketNames = new String[buckets.length]; for (int i = 0; i < buckets.length; i++) { bucketNames[i] = buckets[i].getName(); } ManageDistributionsDialog.showDialog(ownerFrame, cloudFrontService, bucketNames, this); } else if ("AddThirdPartyBucket".equals(event.getActionCommand())) { addThirdPartyBucket(); } else if ("UpdateBucketACL".equals(event.getActionCommand())) { updateBucketAccessControlList(); } else if ("UpdateBucketRequesterPaysStatus".equals(event.getActionCommand())) { updateBucketRequesterPaysSetting(); } // Object Events else if ("ViewOrModifyObjectAttributes".equals(event.getActionCommand())) { displayObjectsAttributesDialog(); } else if ("CopyObjects".equals(event.getActionCommand())) { copyObjects(); } else if ("RefreshObjects".equals(event.getActionCommand())) { listObjects(); } else if ("UpdateObjectACL".equals(event.getActionCommand())) { displayAclModificationDialog(); } else if ("GeneratePublicGetURLs".equals(event.getActionCommand())) { generatePublicGetUrls(); } else if ("GenerateTorrentURL".equals(event.getActionCommand())) { generateTorrentUrl(); } else if ("DeleteObjects".equals(event.getActionCommand())) { deleteSelectedObjects(); } else if ("DownloadObjects".equals(event.getActionCommand())) { downloadSelectedObjects(); } else if ("UploadFiles".equals(event.getActionCommand())) { JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setDialogTitle("Choose files to upload"); fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); fileChooser.setApproveButtonText("Upload files"); fileChooser.setCurrentDirectory(fileChoosersLastUploadDirectory); int returnVal = fileChooser.showOpenDialog(ownerFrame); if (returnVal != JFileChooser.APPROVE_OPTION) { return; } final File[] uploadFiles = fileChooser.getSelectedFiles(); if (uploadFiles.length == 0) { return; } // Save the chosen directory location for next time. fileChoosersLastUploadDirectory = uploadFiles[0].getParentFile(); uploadFiles(uploadFiles); } else if (event.getSource().equals(filterObjectsCheckBox)) { if (filterObjectsCheckBox.isSelected()) { filterObjectsPanel.setVisible(true); } else { filterObjectsPanel.setVisible(false); filterObjectsPrefix.setText(""); if (filterObjectsDelimiter.getSelectedIndex() != 0) { filterObjectsDelimiter.setSelectedIndex(0); } } } // Tools events else if ("BucketLogging".equals(event.getActionCommand())) { S3Bucket[] buckets = bucketTableModel.getBuckets(); BucketLoggingDialog.showDialog(ownerFrame, s3ServiceMulti.getS3Service(), buckets, this); } // Preference Events else if ("PreferencesDialog".equals(event.getActionCommand())) { PreferencesDialog.showDialog(cockpitPreferences, ownerFrame, this); // Save a user's preferences if requested, otherwise wipe any existing preferences file. File cockpitPreferencesPropertiesFile = new File(cockpitHomeDirectory, Constants.COCKPIT_PROPERTIES_FILENAME); if (cockpitPreferences.isRememberPreferences()) { try { Properties properties = cockpitPreferences.toProperties(); if (!cockpitHomeDirectory.exists()) { cockpitHomeDirectory.mkdir(); } properties.list(new PrintStream(new FileOutputStream(cockpitPreferencesPropertiesFile))); } catch (IOException e) { String message = "Unable to save your preferences"; log.error(message, e); ErrorDialog.showDialog(ownerFrame, this, message, e); } } else if (cockpitPreferencesPropertiesFile.exists()) { // User elected not to store preferences, delete the existing preferences file. cockpitPreferencesPropertiesFile.delete(); } if (cockpitPreferences.isEncryptionPasswordSet()) { try { encryptionUtil = new EncryptionUtil(cockpitPreferences.getEncryptionPassword(), cockpitPreferences.getEncryptionAlgorithm(), EncryptionUtil.DEFAULT_VERSION); } catch (Exception e) { String message = "Unable to start encryption utility"; log.error(message, e); ErrorDialog.showDialog(ownerFrame, this, message, e); } } else { encryptionUtil = null; } } // Ooops... else { log.debug("Unrecognised ActionEvent command '" + event.getActionCommand() + "' in " + event); } }