public boolean accept(File pathname) { if (pathname.isDirectory()) return true; else { if (pathname.getName().indexOf(".scl") != -1) return true; else return false; } }
/** * Load a file of a particular type. It's a pretty standard helper function, which uses DarwinCSV * and setCurrentCSV(...) to make file loading happen with messaging and whatnot. We can also * reset the display: just call loadFile(null). * * @param file The file to load. * @param type The type of file (see DarwinCSV's constants). */ private void loadFile(File file, short type) { // If the file was reset, reset the display and keep going. if (file == null) { mainFrame.setTitle(basicTitle); setCurrentCSV(null); return; } // Load up a new DarwinCSV and set current CSV. try { setCurrentCSV(new DarwinCSV(file, type)); } catch (IOException ex) { MessageBox.messageBox( mainFrame, "Could not read file '" + file + "'", "Unable to read file '" + file + "': " + ex); } // Set the main frame title, based on the filename and the index. mainFrame.setTitle( basicTitle + ": " + file.getName() + " (" + String.format("%,d", currentCSV.getRowIndex().getRowCount()) + " rows)"); }
private boolean checkForSave() { // build warning message String message; if (file == null) { message = "File has been modified. Save changes?"; } else { message = "File \"" + file.getName() + "\" has been modified. Save changes?"; } // show confirm dialog int r = JOptionPane.showConfirmDialog( this, new JLabel(message), "Warning!", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if (r == JOptionPane.YES_OPTION) { // Save File if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { // write the file physWriteTextFile(fileChooser.getSelectedFile(), textView.getText()); } else { // user cancelled save after all return false; } } return r != JOptionPane.CANCEL_OPTION; }
/** * The ActionListener implementation * * @param event the event. */ public void actionPerformed(ActionEvent event) { String searchText = textField.getText().trim(); if (searchText.equals("") && !saveAs.isSelected() && (fileLength > 10000000)) { textPane.setText("Blank search text is not allowed for large IdTables."); } else { File outputFile = null; if (saveAs.isSelected()) { outputFile = chooser.getSelectedFile(); if (outputFile != null) { String name = outputFile.getName(); int k = name.lastIndexOf("."); if (k != -1) name = name.substring(0, k); name += ".txt"; File parent = outputFile.getAbsoluteFile().getParentFile(); outputFile = new File(parent, name); chooser.setSelectedFile(outputFile); } if (chooser.showSaveDialog(this) != JFileChooser.APPROVE_OPTION) System.exit(0); outputFile = chooser.getSelectedFile(); } textPane.setText(""); Searcher searcher = new Searcher(searchText, event.getSource().equals(searchPHI), outputFile); searcher.start(); } }
private String getFileExt(File f) { String name = f.getName(); int pos = name.lastIndexOf('.'); if (pos > 0) { return name.substring(pos); } return ""; }
private String physReadTextFile(File file) { // physically read text file try { BufferedReader input = new BufferedReader(new InputStreamReader(new FileInputStream(file))); StringBuffer tmp = new StringBuffer(); while (input.ready()) { tmp.append(input.readLine()); tmp.append("\n"); } return tmp.toString(); } catch (FileNotFoundException e) { // not sure how this can happen showErrorDialog("Unable to load \"" + file.getName() + "\" (file not found)"); } catch (IOException e) { // This happens if e.g. file already exists and // we do not have write permissions showErrorDialog("Unable to load \"" + file.getName() + "\" (I/O error)"); } return new String(""); }
/** Set the template file path. */ private boolean setTemplateFile(String pathStr) { File templateFile = new File(templateCh.getSelectedPath(pathStr)); if (!templateFile.getName().toLowerCase().endsWith(".tpl")) { final String templateCaption = ResourceHandler.getMessage("nottemplatefile_dialog.caption"); MessageFormat formatter = new MessageFormat(ResourceHandler.getMessage("nottemplatefile_dialog.info0")); final String errorMessage = formatter.format(new Object[] {templateFile.getName()}); String defaultTemplateName = PluginConverter.getDefaultTemplateFileName(); JOptionPane.showMessageDialog(this, errorMessage, templateCaption, JOptionPane.ERROR_MESSAGE); templateCh.select(templateCh.getPreviousSelection()); return false; } try { converter.setTemplateFilePath(templateCh.getSelectedPath(pathStr)); } catch (FileNotFoundException e) { // TO-DO: found it, but it's not a file. // TO-DO: Throw up a Dialog -- "Not a valid file, resetting to default file" final String caption = ResourceHandler.getMessage("notdirectory_dialog.caption0"); MessageFormat formatter; String info_msg; if (pathStr.equals("")) { info_msg = ResourceHandler.getMessage("notdirectory_dialog.info5"); } else { formatter = new MessageFormat(ResourceHandler.getMessage("notdirectory_dialog.info1")); info_msg = formatter.format(new Object[] {pathStr}); } final String info = info_msg; JOptionPane.showMessageDialog(this, info, caption, JOptionPane.ERROR_MESSAGE); return false; } return true; }
@Override public void approveSelection() { File file = getSelectedFile(); if (file != null) { FileFilter filter = getFileFilter(); if (filter != null && filter instanceof FileNameExtensionFilter) { String[] extensions = ((FileNameExtensionFilter) filter).getExtensions(); boolean goodExt = false; for (String ext : extensions) { if (file.getName().toLowerCase().endsWith("." + ext.toLowerCase())) { goodExt = true; break; } } if (!goodExt) { file = new File(file.getParent(), file.getName() + "." + extensions[0]); } } if (file.exists()) { String okStr = Messages.FILE_CHOOSER_FILE_EXISTS_OK_OPTION; String cancelStr = Messages.FILE_CHOOSER_FILE_EXISTS_CANCEL_OPTION; int ret = JOptionPane.showOptionDialog( this, Resources.format(Messages.FILE_CHOOSER_FILE_EXISTS_MESSAGE, file.getName()), Messages.FILE_CHOOSER_FILE_EXISTS_TITLE, JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, new Object[] {okStr, cancelStr}, okStr); if (ret != JOptionPane.OK_OPTION) { return; } } setSelectedFile(file); } super.approveSelection(); }
public void saveFile() { if (file == null) { // first save file, so prompt for name. saveFileAs(); } else { // file already named so just write it. physWriteTextFile(file, textView.getText()); // update status statusView.setText(" Saved file \"" + file.getName() + "\"."); // reset dirty bit dirty = false; } }
// Take a tree of files starting in a directory in a zip file // and copy them to a disk directory, recreating the tree. private int unpackZipFile( File inZipFile, String directory, String parent, boolean suppressFirstPathElement) { int count = 0; if (!inZipFile.exists()) return count; parent = parent.trim(); if (!parent.endsWith(File.separator)) parent += File.separator; if (!directory.endsWith(File.separator)) directory += File.separator; File outFile = null; try { ZipFile zipFile = new ZipFile(inZipFile); Enumeration zipEntries = zipFile.entries(); while (zipEntries.hasMoreElements()) { ZipEntry entry = (ZipEntry) zipEntries.nextElement(); String name = entry.getName().replace('/', File.separatorChar); if (name.startsWith(directory)) { if (suppressFirstPathElement) name = name.substring(directory.length()); outFile = new File(parent + name); // Create the directory, just in case if (name.indexOf(File.separatorChar) >= 0) { String p = name.substring(0, name.lastIndexOf(File.separatorChar) + 1); File dirFile = new File(parent + p); dirFile.mkdirs(); } if (!entry.isDirectory()) { System.out.println("Installing " + outFile); // Copy the file BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(outFile)); BufferedInputStream in = new BufferedInputStream(zipFile.getInputStream(entry)); int size = 1024; int n = 0; byte[] b = new byte[size]; while ((n = in.read(b, 0, size)) != -1) out.write(b, 0, n); in.close(); out.flush(); out.close(); // Count the file count++; } } } zipFile.close(); } catch (Exception e) { System.err.println("...an error occured while installing " + outFile); e.printStackTrace(); System.err.println("Error copying " + outFile.getName() + "\n" + e.getMessage()); return -count; } System.out.println(count + " files were installed."); return count; }
public void saveFileAs() { // Force user to enter new file name if (fileChooser.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { file = fileChooser.getSelectedFile(); } else { // user cancelled save after all return; } // file selected, so write it. physWriteTextFile(file, textView.getText()); // update status statusView.setText(" Saved file \"" + file.getName() + "\"."); // reset dirty bit dirty = false; }
@Override public boolean accept(File file) { if (file.isDirectory()) { return true; } String name = file.getName().toLowerCase(); for (int i = 0; i < extensions.length; ++i) { if (name.endsWith(extensions[i])) { return true; } } return false; }
public void openFile() { if (!dirty || checkForSave()) { if (fileChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) { file = fileChooser.getSelectedFile(); } else { // user cancelled open after all return; } // load file into text view textView.setText(physReadTextFile(file)); // update status statusView.setText(" Loaded file \"" + file.getName() + "\"."); // reset dirty bit dirty = false; } }
public boolean load(File file) { this.file = file; if (file != null && file.isFile()) { try { errStr = null; audioInputStream = AudioSystem.getAudioInputStream(file); fileName = file.getName(); format = audioInputStream.getFormat(); } catch (Exception ex) { reportStatus(ex.toString()); return false; } } else { reportStatus("Audio file required."); return false; } numChannels = format.getChannels(); sampleRate = (double) format.getSampleRate(); sampleBitSize = format.getSampleSizeInBits(); long frameLength = audioInputStream.getFrameLength(); long milliseconds = (long) ((frameLength * 1000) / audioInputStream.getFormat().getFrameRate()); double audioFileDuration = milliseconds / 1000.0; if (audioFileDuration > MAX_AUDIO_DURATION) duration = MAX_AUDIO_DURATION; else duration = audioFileDuration; frameLength = (int) Math.floor((duration / audioFileDuration) * (double) frameLength); try { audioBytes = new byte[(int) frameLength * format.getFrameSize()]; audioInputStream.read(audioBytes); } catch (Exception ex) { reportStatus(ex.toString()); return false; } getAudioData(); return true; }
public boolean loadSourceFile(File file) { boolean result = false; selectedPath = file.getParent(); BufferedReader sourceFile = null; String directoryPath = file.getParent(); String sourceName = file.getName(); int idx = sourceName.lastIndexOf("."); fileExt = idx == -1 ? "" : sourceName.substring(idx + 1); baseName = idx == -1 ? sourceName.substring(0) : sourceName.substring(0, idx); String basePath = directoryPath + File.separator + baseName; DataOptions.directoryPath = directoryPath; sourcePath = file.getPath(); AssemblerOptions.sourcePath = sourcePath; AssemblerOptions.listingPath = basePath + ".lst"; AssemblerOptions.objectPath = basePath + ".cd"; String var = System.getenv("ROPE_MACROS_DIR"); if (var != null && !var.isEmpty()) { File dir = new File(var); if (dir.exists() && dir.isDirectory()) { AssemblerOptions.macroPath = var; } else { AssemblerOptions.macroPath = directoryPath; } } else { AssemblerOptions.macroPath = directoryPath; } DataOptions.inputPath = AssemblerOptions.objectPath; DataOptions.outputPath = basePath + ".out"; DataOptions.readerPath = null; DataOptions.punchPath = basePath + ".pch"; DataOptions.tape1Path = basePath + ".mt1"; DataOptions.tape2Path = basePath + ".mt2"; DataOptions.tape3Path = basePath + ".mt3"; DataOptions.tape4Path = basePath + ".mt4"; DataOptions.tape5Path = basePath + ".mt5"; DataOptions.tape6Path = basePath + ".mt6"; this.setTitle("EDIT: " + sourceName); fileText.setText(sourcePath); if (dialog == null) { dialog = new AssemblerDialog(mainFrame, "Assembler options"); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension dialogSize = dialog.getSize(); dialog.setLocation( (screenSize.width - dialogSize.width) / 2, (screenSize.height - dialogSize.height) / 2); } dialog.initialize(); AssemblerOptions.command = dialog.buildCommand(); sourceArea.setText(null); try { sourceFile = new BufferedReader(new FileReader(file)); String line; while ((line = sourceFile.readLine()) != null) { sourceArea.append(line + "\n"); } sourceArea.setCaretPosition(0); optionsButton.setEnabled(true); assembleButton.setEnabled(true); saveButton.setEnabled(true); setSourceChanged(false); undoMgr.discardAllEdits(); result = true; } catch (IOException ex) { ex.printStackTrace(); } finally { try { if (sourceFile != null) { sourceFile.close(); } } catch (IOException ignore) { } } return result; }
/** * Class constructor; creates a new Installer object, displays a JFrame introducing the program, * allows the user to select an install directory, and copies files from the jar into the * directory. */ public Installer(String args[]) { // Inputs are --install-dir INSTALL_DIR for (int k = 0; k < args.length; k = k + 2) { switch (args[k]) { case "--install-dir": directory = new File(args[k + 1]); System.out.println(directory); break; case "--port": port = Integer.parseInt(args[k + 1]); break; } } cp = new Stream(); // Find the installer program so we can get to the files. installer = getInstallerProgramFile(); String name = installer.getName(); programName = (name.substring(0, name.indexOf("-"))).toUpperCase(); // Get the installation information thisJava = System.getProperty("java.version"); thisJavaBits = System.getProperty("sun.arch.data.model") + " bits"; // Find the ImageIO Tools and get the version String javaHome = System.getProperty("java.home"); File extDir = new File(javaHome); extDir = new File(extDir, "lib"); extDir = new File(extDir, "ext"); File clib = getFile(extDir, "clibwrapper_jiio", ".jar"); File jai = getFile(extDir, "jai_imageio", ".jar"); imageIOTools = (clib != null) && clib.exists() && (jai != null) && jai.exists(); if (imageIOTools) { Hashtable<String, String> jaiManifest = getManifestAttributes(jai); imageIOVersion = jaiManifest.get("Implementation-Version"); } // Get the CTP.jar parameters Hashtable<String, String> manifest = getJarManifestAttributes("/CTP/libraries/CTP.jar"); programDate = manifest.get("Date"); buildJava = manifest.get("Java-Version"); // Get the util.jar parameters Hashtable<String, String> utilManifest = getJarManifestAttributes("/CTP/libraries/util.jar"); utilJava = utilManifest.get("Java-Version"); // Get the MIRC.jar parameters (if the plugin is present) Hashtable<String, String> mircManifest = getJarManifestAttributes("/CTP/libraries/MIRC.jar"); if (mircManifest != null) { mircJava = mircManifest.get("Java-Version"); mircDate = mircManifest.get("Date"); mircVersion = mircManifest.get("Version"); } // Set up the installation information for display if (imageIOVersion.equals("")) { imageIOVersion = "<b><font color=\"red\">not installed</font></b>"; } else if (imageIOVersion.startsWith("1.0")) { imageIOVersion = "<b><font color=\"red\">" + imageIOVersion + "</font></b>"; } if (thisJavaBits.startsWith("64")) { thisJavaBits = "<b><font color=\"red\">" + thisJavaBits + "</font></b>"; } boolean javaOK = (thisJava.compareTo(buildJava) >= 0); javaOK &= (thisJava.compareTo(utilJava) >= 0); javaOK &= (thisJava.compareTo(mircJava) >= 0); if (!javaOK) { thisJava = "<b><font color=\"red\">" + thisJava + "</font></b>"; } if (directory == null) exit(); // Point to the parent of the directory in which to install the program. // so the copy process works correctly for directory trees. // // If the user has selected a directory named "CTP", // then assume that this is the directory in which // to install the program. // // If the directory is not CTP, see if it is called "RSNA" and contains // the Launcher program, in which case we can assume that it is an // installation that was done with Bill Weadock's all-in-one installer for Windows. // // If neither of those cases is true, then this is already the parent of the // directory in which to install the program if (directory.getName().equals("CTP")) { directory = directory.getParentFile(); } else if (directory.getName().equals("RSNA") && (new File(directory, "Launcher.jar")).exists()) { suppressFirstPathElement = true; } // Cleanup old releases cleanup(directory); // Get a port for the server. if (port < 0) { if (checkServer(-port, false)) { System.err.println( "CTP appears to be running.\nPlease stop CTP and run the installer again."); System.exit(0); } } // Now install the files and report the results. int count = unpackZipFile(installer, "CTP", directory.getAbsolutePath(), suppressFirstPathElement); if (count > 0) { // Create the service installer batch files. updateWindowsServiceInstaller(); updateLinuxServiceInstaller(); // If this was a new installation, set up the config file and set the port installConfigFile(port); // Make any necessary changes in the config file to reflect schema evolution fixConfigSchema(); System.out.println("Installation complete."); System.out.println(programName + " has been installed successfully."); System.out.println(count + " files were installed."); } else { System.err.println("Installation failed."); System.err.println(programName + " could not be fully installed."); } if (!programName.equals("ISN") && startRunner(new File(directory, "CTP"))) System.exit(0); }
private void cleanup(File directory) { // Clean up from old installations, removing or renaming files. // Note that directory is the parent of the CTP directory // unless the original installation was done by Bill Weadock's // all-in-one installer for Windows. // Get a file pointing to the CTP directory. // This might be the current directory, or // it might be the CTP child. File dir; if (directory.getName().equals("RSNA")) dir = directory; else dir = new File(directory, "CTP"); // If CTP.jar exists in this directory, it is a really // old CTP main file - not used anymore File ctp = new File(dir, "CTP.jar"); if (ctp.exists()) ctp.delete(); // These are old names for the Launcher.jar file File launcher = new File(dir, "CTP-launcher.jar"); if (launcher.exists()) launcher.delete(); launcher = new File(dir, "TFS-launcher.jar"); if (launcher.exists()) launcher.delete(); // Delete the obsolete CTP-runner.jar file File runner = new File(dir, "CTP-runner.jar"); if (runner.exists()) runner.delete(); // Delete the obsolete MIRC-copier.jar file File copier = new File(dir, "MIRC-copier.jar"); if (copier.exists()) copier.delete(); // Rename the old versions of the properties files File oldprops = new File(dir, "CTP-startup.properties"); File newprops = new File(dir, "CTP-launcher.properties"); File correctprops = new File(dir, "Launcher.properties"); if (oldprops.exists()) { if (newprops.exists() || correctprops.exists()) oldprops.delete(); else oldprops.renameTo(correctprops); } if (newprops.exists()) { if (correctprops.exists()) newprops.delete(); else newprops.renameTo(correctprops); } // Get rid of obsolete startup and shutdown programs File startup = new File(dir, "CTP-startup.jar"); if (startup.exists()) startup.delete(); File shutdown = new File(dir, "CTP-shutdown.jar"); if (shutdown.exists()) shutdown.delete(); // Get rid of the obsolete linux directory File linux = new File(dir, "linux"); if (linux.exists()) { startup = new File(linux, "CTP-startup.jar"); if (startup.exists()) startup.delete(); shutdown = new File(linux, "CTP-shutdown.jar"); if (shutdown.exists()) shutdown.delete(); linux.delete(); } // clean up the libraries directory File libraries = new File(dir, "libraries"); if (libraries.exists()) { // remove obsolete versions of the slf4j libraries // and the dcm4che-imageio libraries File[] files = libraries.listFiles(); for (File file : files) { if (file.isFile()) { String name = file.getName(); if (name.startsWith("slf4j-") || name.startsWith("dcm4che-imageio-rle")) { file.delete(); } } } // remove the email subdirectory File email = new File(libraries, "email"); deleteAll(email); // remove the xml subdirectory File xml = new File(libraries, "xml"); deleteAll(xml); // remove the sftp subdirectory File sftp = new File(libraries, "sftp"); deleteAll(xml); // move edtftpj.jar to the ftp directory File edtftpj = new File(libraries, "edtftpj.jar"); if (edtftpj.exists()) { File ftp = new File(libraries, "ftp"); ftp.mkdirs(); File ftpedtftpj = new File(ftp, "edtftpj.jar"); edtftpj.renameTo(ftpedtftpj); } } // remove the obsolete xml library under dir File xml = new File(dir, "xml"); deleteAll(xml); // remove the dicom profiles so any // obsolete files will disappear File profiles = new File(dir, "profiles"); File dicom = new File(profiles, "dicom"); deleteAll(dicom); dicom.mkdirs(); // Remove the index.html file so it will be rebuilt from // example-index.html when the system next starts. File root = new File(dir, "ROOT"); if (root.exists()) { File index = new File(root, "index.html"); index.delete(); } }
public boolean accept(File file) { String name = file.getName(); return name.startsWith(nameStart) && name.endsWith(nameEnd); }
public void saveUnsaved() throws SaveAbortedException { if (!saved) { int option = 0; if (loadedFile == null) option = JOptionPane.showConfirmDialog( this, new JLabel("Save changes to UNTITLED?"), "Warning", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); else option = JOptionPane.showConfirmDialog( this, new JLabel("Save changes to " + loadedFile.getName() + "?"), "Warning", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); if (option == JOptionPane.YES_OPTION) { if (loadedFile == null) // SAVE NEW FILE { if (nameTF.getText().equals("")) { JOptionPane.showMessageDialog( this, new JLabel("Please type in the Scale Name"), "Warning", JOptionPane.WARNING_MESSAGE); throw new SaveAbortedException(); } fileChooser.setFileFilter(filter); int option2 = fileChooser.showSaveDialog(this); if (option2 == JFileChooser.APPROVE_OPTION) { File target = fileChooser.getSelectedFile(); try { PrintStream stream = new PrintStream(new FileOutputStream(target), true); save(stream); stream.close(); } catch (Exception ex) { JOptionPane.showMessageDialog( this, new JLabel("Error: " + ex.getMessage()), "Error", JOptionPane.ERROR_MESSAGE); } } else throw new SaveAbortedException(); ; } else // save LOADED FILE { try { PrintStream stream = new PrintStream(new FileOutputStream(loadedFile), true); save(stream); stream.close(); } catch (Exception ex) { JOptionPane.showMessageDialog( this, new JLabel("Error: " + ex.getMessage()), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (option == JOptionPane.CANCEL_OPTION) throw new SaveAbortedException(); ; } }
public void actionPerformed(ActionEvent e) { JButton b = (JButton) e.getSource(); if (b.getText() == "PLAY") { if (scoreP != null) scoreP.playScale(sp.getScale(), tempoP.getValue()); } else if (b.getText() == "New") { try { saveUnsaved(); } catch (SaveAbortedException ex) { return; } sp.notes.removeAllElements(); sp.repaint(); nameTF.setText(""); loadedFile = null; } else if (b.getText() == "Save") { if (nameTF.getText().equals("")) { JOptionPane.showMessageDialog( this, new JLabel("Please type in the Scale Name"), "Warning", JOptionPane.WARNING_MESSAGE); return; } fileChooser.setFileFilter(filter); int option = fileChooser.showSaveDialog(this); if (option == JFileChooser.APPROVE_OPTION) { File target = fileChooser.getSelectedFile(); if (target.getName().indexOf(".scl") == -1) target = new File(target.getPath() + ".scl"); try { PrintStream stream = new PrintStream(new FileOutputStream(target), true); save(stream); stream.close(); } catch (Exception ex) { JOptionPane.showMessageDialog( this, new JLabel("Error: " + ex.getMessage()), "Error", JOptionPane.ERROR_MESSAGE); } } } else if (b.getText() == "Load") { try { saveUnsaved(); } catch (SaveAbortedException ex) { return; } fileChooser.setFileFilter(filter); int option = fileChooser.showOpenDialog(this); if (option == JFileChooser.APPROVE_OPTION) { loadedFile = fileChooser.getSelectedFile(); SAXParserFactory factory = SAXParserFactory.newInstance(); ScaleParser handler = new ScaleParser(false); try { SAXParser parser = factory.newSAXParser(); parser.parse(loadedFile, handler); // System.out.println("success"); } catch (Exception ex) { // System.out.println("no!!!!!! exception: "+e); // System.out.println(ex.getMessage()); ex.printStackTrace(); } // -----now :P:P--------------- System.out.println("name: " + handler.getName()); nameTF.setText(handler.getName()); sp.notes.removeAllElements(); int[] scale = handler.getScale(); for (int i = 0; i < scale.length; i++) { sp.addNote(scale[i]); } sp.repaint(); } else loadedFile = null; } }
public void setBaseFile(File file) { if (file != null) { baseField.setText(file.getName()); baseFile = file; } }