List of usage examples for javax.swing JFileChooser APPROVE_OPTION
int APPROVE_OPTION
To view the source code for javax.swing JFileChooser APPROVE_OPTION.
Click Source Link
From source file:misc.DesktopDemo.java
private void onChooseFile(ActionEvent evt) { if (evt.getSource() == btnFile) { int returnVal = fc.showOpenDialog(DesktopDemo.this); if (returnVal == JFileChooser.APPROVE_OPTION) { file = fc.getSelectedFile(); txtFile.setText(file.getAbsolutePath()); }//w w w . ja va 2s. c om } }
From source file:com.compomics.cell_coord.gui.controller.load.LoadTracksController.java
/** * Choose the directory and load its data into a given JTree. * * @param dataTree/*ww w . ja va 2s . com*/ */ private void chooseDirectoryAndLoadData() { JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Please select a root folder containing your files"); // allow for directories only fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); // removing "All Files" option from FileType fileChooser.setAcceptAllFileFilterUsed(false); int returnVal = fileChooser.showOpenDialog(cellCoordController.getCellCoordFrame()); if (returnVal == JFileChooser.APPROVE_OPTION) { // the directory for the data directory = fileChooser.getSelectedFile(); try { loadDataIntoTree(); } catch (LoadDirectoryException ex) { LOG.error(ex.getMessage()); cellCoordController.showMessage(ex.getMessage(), "wrong directory structure error", JOptionPane.ERROR_MESSAGE); } } else { cellCoordController.showMessage("Open command cancelled by user", "", JOptionPane.INFORMATION_MESSAGE); } }
From source file:com.igormaznitsa.jhexed.swing.editor.ui.dialogs.hexeditors.DialogEditSVGImageValue.java
private void buttonSaveAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSaveAsActionPerformed final JFileChooser dlg = new JFileChooser(); dlg.addChoosableFileFilter(new FileFilter() { @Override/*from ww w . java2 s . c o m*/ public boolean accept(File f) { return f.isDirectory() || f.getName().toLowerCase(Locale.ENGLISH).endsWith(".svg"); } @Override public String getDescription() { return "SVG files (*.svg)"; } }); if (dlg.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) { File file = dlg.getSelectedFile(); if (FilenameUtils.getExtension(file.getName()).isEmpty()) { file = new File(file.getParentFile(), file.getName() + ".svg"); } if (file.exists() && JOptionPane.showConfirmDialog(this.parent, "Overwrite file '" + file.getAbsolutePath() + "\'?", "Overwriting", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.CANCEL_OPTION) { return; } try { FileUtils.writeByteArrayToFile(file, this.value.getImage().getImageData()); } catch (IOException ex) { Log.error("Can't write image [" + file + ']', ex); JOptionPane.showMessageDialog(this, "Can't save the file for error!", "IO Error", JOptionPane.ERROR_MESSAGE); } } }
From source file:userinterface.properties.GUIGraphHandler.java
private void initComponents() { theTabs = new JTabbedPane() { @Override//www. j a v a2 s . com public String getTitleAt(int index) { try { TabClosePanel panel = (TabClosePanel) getTabComponentAt(index); return panel.getTitle(); } catch (Exception e) { return ""; } } @Override public String getToolTipTextAt(int index) { return ((TabClosePanel) getTabComponentAt(index)).getToolTipText(); } @Override public void setTitleAt(int index, String title) { if (((TabClosePanel) getTabComponentAt(index)) == null) { return; } ((TabClosePanel) getTabComponentAt(index)).setTitle(title); } @Override public void setIconAt(int index, Icon icon) { ((TabClosePanel) getTabComponentAt(index)).setIcon(icon); } @Override public void setToolTipTextAt(int index, String toolTipText) { ((TabClosePanel) getTabComponentAt(index)).setToolTip(toolTipText); } }; theTabs.addMouseListener(this); theTabs.addMouseWheelListener(new MouseWheelListener() { @Override public void mouseWheelMoved(MouseWheelEvent e) { if (e.getPreciseWheelRotation() > 0.0) { if (theTabs.getSelectedIndex() != (theTabs.getTabCount() - 1)) theTabs.setSelectedIndex(theTabs.getSelectedIndex() + 1); } else { if (theTabs.getSelectedIndex() != 0) theTabs.setSelectedIndex(theTabs.getSelectedIndex() - 1); } } }); setLayout(new BorderLayout()); add(theTabs, BorderLayout.CENTER); graphOptions = new AbstractAction() { public void actionPerformed(ActionEvent e) { GraphOptions graphOptions = options.get(theTabs.getSelectedIndex()); graphOptions.setVisible(true); } }; graphOptions.putValue(Action.NAME, "Graph options"); graphOptions.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_G)); graphOptions.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallOptions.png")); graphOptions.putValue(Action.LONG_DESCRIPTION, "Displays the options dialog for the graph."); zoomIn = new AbstractAction() { public void actionPerformed(ActionEvent e) { JPanel mgm = models.get(theTabs.getSelectedIndex()); if (mgm instanceof ChartPanel) ((ChartPanel) mgm).zoomInBoth(-1, -1); else if (mgm instanceof Graph3D) { double rho = ((Graph3D) mgm).getChart3DPanel().getViewPoint().getRho(); ((Graph3D) mgm).getChart3DPanel().getViewPoint().setRho(rho - 5); ((Graph3D) mgm).getChart3DPanel().repaint(); } } }; zoomIn.putValue(Action.NAME, "In"); zoomIn.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_I)); zoomIn.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallPlayerFwd.png")); zoomIn.putValue(Action.LONG_DESCRIPTION, "Zoom in on the graph."); zoomOut = new AbstractAction() { public void actionPerformed(ActionEvent e) { JPanel mgm = models.get(theTabs.getSelectedIndex()); if (mgm instanceof ChartPanel) ((ChartPanel) mgm).zoomOutBoth(-1, -1); else if (mgm instanceof Graph3D) { double rho = ((Graph3D) mgm).getChart3DPanel().getViewPoint().getRho(); ((Graph3D) mgm).getChart3DPanel().getViewPoint().setRho(rho + 5); ((Graph3D) mgm).getChart3DPanel().repaint(); } } }; zoomOut.putValue(Action.NAME, "Out"); zoomOut.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_O)); zoomOut.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallPlayerRew.png")); zoomOut.putValue(Action.LONG_DESCRIPTION, "Zoom out of the graph."); zoomDefault = new AbstractAction() { public void actionPerformed(ActionEvent e) { JPanel mgm = models.get(theTabs.getSelectedIndex()); if (mgm instanceof ChartPanel) ((ChartPanel) mgm).restoreAutoBounds(); else if (mgm instanceof Graph3D) { ((Graph3D) mgm).getChart3DPanel().zoomToFit(); ((Graph3D) mgm).getChart3DPanel().getDrawable() .setViewPoint(new ViewPoint3D(-Math.PI / 2, Math.PI * 1.124, 70.0, 0.0)); ((Graph3D) mgm).getChart3DPanel().repaint(); } } }; zoomDefault.putValue(Action.NAME, "Default"); zoomDefault.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_D)); zoomDefault.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallPlayerStart.png")); zoomDefault.putValue(Action.LONG_DESCRIPTION, "Set the default zoom for the graph."); importXML = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (plug.showOpenFileDialog(graFilter) != JFileChooser.APPROVE_OPTION) return; try { Graph mgm = Graph.load(plug.getChooserFile()); addGraph(mgm); } catch (GraphException ex) { plug.error("Could not import PRISM graph file:\n" + ex.getMessage()); } } }; importXML.putValue(Action.NAME, "PRISM graph (*.gra)"); importXML.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_I)); importXML.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallFileGraph.png")); importXML.putValue(Action.LONG_DESCRIPTION, "Imports a saved PRISM graph from a file."); addFunction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { plotNewFunction(); } }; addFunction.putValue(Action.NAME, "Plot function"); addFunction.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_P)); addFunction.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallFunction.png")); addFunction.putValue(Action.LONG_DESCRIPTION, "Plots a new specified function on the current graph"); exportXML = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (plug.showSaveFileDialog(graFilter) != JFileChooser.APPROVE_OPTION) return; Graph mgm = (Graph) models.get(theTabs.getSelectedIndex()); try { mgm.save(plug.getChooserFile()); } catch (PrismException ex) { plug.error("Could not export PRISM graph file:\n" + ex.getMessage()); } } }; exportXML.putValue(Action.NAME, "PRISM graph (*.gra)"); exportXML.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_X)); exportXML.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallFileGraph.png")); exportXML.putValue(Action.LONG_DESCRIPTION, "Export graph as a PRISM graph file."); exportImageJPG = new AbstractAction() { public void actionPerformed(ActionEvent e) { JPanel model = getModel(theTabs.getSelectedIndex()); GUIImageExportDialog imageDialog = new GUIImageExportDialog(plug.getGUI(), model, GUIImageExportDialog.JPEG); saveImage(imageDialog); } }; exportImageJPG.putValue(Action.NAME, "JPEG Interchange Format (*.jpg, *.jpeg)"); exportImageJPG.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_J)); exportImageJPG.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallFileImage.png")); exportImageJPG.putValue(Action.LONG_DESCRIPTION, "Export graph as a JPEG file."); exportImagePNG = new AbstractAction() { public void actionPerformed(ActionEvent e) { JPanel model = getModel(theTabs.getSelectedIndex()); GUIImageExportDialog imageDialog = new GUIImageExportDialog(plug.getGUI(), model, GUIImageExportDialog.PNG); saveImage(imageDialog); } }; exportImagePNG.putValue(Action.NAME, "Portable Network Graphics (*.png)"); exportImagePNG.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_P)); exportImagePNG.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallFileImage.png")); exportImagePNG.putValue(Action.LONG_DESCRIPTION, "Export graph as a Portable Network Graphics file."); exportPDF = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (plug.showSaveFileDialog(pdfFilter) != JFileChooser.APPROVE_OPTION) return; JPanel mgm = models.get(theTabs.getSelectedIndex()); if (mgm instanceof ChartPanel) Graph.exportToPDF(plug.getChooserFile(), ((ChartPanel) mgm).getChart()); else if (mgm instanceof Graph3D) { Graph3D.exportToPDF(plug.getChooserFile(), ((Graph3D) mgm).getChart3DPanel()); } } }; exportPDF.putValue(Action.NAME, "Portable document format (*.pdf)"); exportPDF.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_P)); exportPDF.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallFilePdf.png")); exportPDF.putValue(Action.LONG_DESCRIPTION, "Export the graph as a Portable document format file."); exportImageEPS = new AbstractAction() { public void actionPerformed(ActionEvent e) { JPanel model = getModel(theTabs.getSelectedIndex()); if (model instanceof ChartPanel) { GUIImageExportDialog imageDialog = new GUIImageExportDialog(plug.getGUI(), (ChartPanel) model, GUIImageExportDialog.EPS); saveImage(imageDialog); } } }; exportImageEPS.putValue(Action.NAME, "Encapsulated PostScript (*.eps)"); exportImageEPS.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_E)); exportImageEPS.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallFilePdf.png")); exportImageEPS.putValue(Action.LONG_DESCRIPTION, "Export graph as an Encapsulated PostScript file."); exportMatlab = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (plug.showSaveFileDialog(matlabFilter) != JFileChooser.APPROVE_OPTION) return; JPanel mgm = models.get(theTabs.getSelectedIndex()); if (mgm instanceof Graph) { try { ((Graph) mgm).exportToMatlab(plug.getChooserFile()); } catch (IOException ex) { plug.error("Could not export Matlab file:\n" + ex.getMessage()); } } else if (mgm instanceof Graph3D) { try { ((Graph3D) mgm).exportToMatlab(plug.getChooserFile()); } catch (IOException e1) { plug.error("Could not export Matlab file:\n" + e1.getMessage()); e1.printStackTrace(); } } } }; exportMatlab.putValue(Action.NAME, "Matlab file (*.m)"); exportMatlab.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_M)); exportMatlab.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallFileMatlab.png")); exportMatlab.putValue(Action.LONG_DESCRIPTION, "Export graph as a Matlab file."); exportGnuplot = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (plug.showSaveFileDialog(gnuplotFilter) != JFileChooser.APPROVE_OPTION) return; JPanel mgm = models.get(theTabs.getSelectedIndex()); if (mgm instanceof ChartPanel) { try { if (mgm instanceof Graph && !(mgm instanceof ParametricGraph)) { ((Graph) mgm).exportToGnuplot(plug.getChooserFile()); } else if (mgm instanceof ParametricGraph) { ((ParametricGraph) mgm).exportToGnuplot(plug.getChooserFile()); } else if (mgm instanceof Histogram) { ((Histogram) mgm).exportToGnuplot(plug.getChooserFile()); } } catch (IOException ex) { plug.error("Could not export Gnuplot file:\n" + ex.getMessage()); } } else if (mgm instanceof Graph3D) { try { ((Graph3D) mgm).exportToGnuplot(plug.getChooserFile()); } catch (IOException ex) { plug.error("Could not export Gnuplot file:\n" + ex.getMessage()); ex.printStackTrace(); } } } }; exportGnuplot.putValue(Action.NAME, "GNU Plot file(*.gnuplot)"); exportGnuplot.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_G)); exportGnuplot.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallgnuplot.png")); exportGnuplot.putValue(Action.LONG_DESCRIPTION, "Export graph as a GNU plot file."); printGraph = new AbstractAction() { public void actionPerformed(ActionEvent e) { JPanel graph = models.get(theTabs.getSelectedIndex()); if (graph instanceof ChartPanel) { if (graph instanceof Graph) { if (!((Graph) graph).getDisplaySettings().getBackgroundColor().equals(Color.white)) { if (plug.questionYesNo( "Your graph has a coloured background, this background will show up on the \n" + "printout. Would you like to make the current background colour white?") == 0) { ((Graph) graph).getDisplaySettings().setBackgroundColor(Color.white); } } } else if (graph instanceof Histogram) { if (!((Histogram) graph).getDisplaySettings().getBackgroundColor().equals(Color.white)) { if (plug.questionYesNo( "Your graph has a coloured background, this background will show up on the \n" + "printout. Would you like to make the current background colour white?") == 0) { ((Histogram) graph).getDisplaySettings().setBackgroundColor(Color.white); } } } ((ChartPanel) graph).createChartPrintJob(); } if (graph instanceof Graph3D) { ((Graph3D) graph).createPrintJob(); } } }; printGraph.putValue(Action.NAME, "Print graph"); printGraph.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_P)); printGraph.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallPrint.png")); printGraph.putValue(Action.LONG_DESCRIPTION, "Print the graph to a printer or file"); deleteGraph = new AbstractAction() { public void actionPerformed(ActionEvent e) { JPanel graph = models.get(theTabs.getSelectedIndex()); models.remove(theTabs.getSelectedIndex()); options.remove(theTabs.getSelectedIndex()); theTabs.remove(graph); } }; deleteGraph.putValue(Action.NAME, "Delete graph"); deleteGraph.putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_D)); deleteGraph.putValue(Action.SMALL_ICON, GUIPrism.getIconFromImage("smallDelete.png")); deleteGraph.putValue(Action.LONG_DESCRIPTION, "Deletes the graph."); zoomMenu = new JMenu("Zoom"); zoomMenu.setMnemonic('Z'); zoomMenu.setIcon(GUIPrism.getIconFromImage("smallView.png")); zoomMenu.add(zoomIn); zoomMenu.add(zoomOut); zoomMenu.add(zoomDefault); exportMenu = new JMenu("Export graph"); exportMenu.setMnemonic('E'); exportMenu.setIcon(GUIPrism.getIconFromImage("smallExport.png")); exportMenu.add(exportXML); exportMenu.add(exportImagePNG); exportMenu.add(exportPDF); exportMenu.add(exportImageEPS); exportMenu.add(exportImageJPG); exportMenu.add(exportMatlab); exportMenu.add(exportGnuplot); importMenu = new JMenu("Import graph"); importMenu.setMnemonic('I'); importMenu.setIcon(GUIPrism.getIconFromImage("smallImport.png")); importMenu.add(importXML); graphMenu.add(graphOptions); graphMenu.add(zoomMenu); graphMenu.addSeparator(); graphMenu.add(printGraph); graphMenu.add(deleteGraph); graphMenu.addSeparator(); graphMenu.add(exportMenu); graphMenu.add(importMenu); graphMenu.add(addFunction); /* Tab context menu */ backMenu.add(importXML); }
From source file:marytts.tools.voiceimport.DatabaseImportMain.java
protected void askIfSave() throws IOException { if (bnl.hasChanged()) { int answer = JOptionPane.showOptionDialog(this, "Do you want to save the list of basenames?", "Save?", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (answer == JOptionPane.YES_OPTION) { JFileChooser fc = new JFileChooser(); fc.setSelectedFile(new File(db.getProp(db.BASENAMEFILE))); int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { bnl.write(fc.getSelectedFile()); }//from ww w. ja va2 s . c o m } } else { System.exit(0); } }
From source file:is.iclt.jcorpald.CorpaldView.java
public void actionPerformed(ActionEvent event) { if (event.getSource() == butRunQuery) { controller.runQuery();//from ww w . j av a2 s . c o m } else if (event.getSource() == butOpenQuery) { int returnVal = queryChooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = queryChooser.getSelectedFile(); controller.openQuery(file); } } else if (event.getSource() == butNewQuery) { controller.newQuery(); } else if (event.getSource() == butSaveQuery) { // save if there is a file already this.doSave(); } else if (event.getSource() == butSaveQueryAs) { this.doSaveAs(); } else if (event.getSource() == butOpenDef) { int returnVal = defChooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = defChooser.getSelectedFile(); controller.openDef(file); } } else if (event.getSource() == butOpenFolder) { this.openFolder(); } else if (event.getSource() == butTextEditor) { this.openTextEditor(); } else if (event.getSource() == butCopyResults) { this.copyToClipboard(); } }
From source file:namedatabasescraper.MainWindow.java
private void jSelectDirectoryButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jSelectDirectoryButtonActionPerformed File file;//from w ww . j a v a 2 s . co m int returnVal = this.jFileChooser.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { file = this.jFileChooser.getSelectedFile(); } else { return; } this.jDirectoryNameTextField.setText(file.getAbsolutePath()); this.populateNamesColumn(); }
From source file:com.nwn.NwnUpdaterHomeView.java
/** * Allow user to specify their NWN directory * @param evt //from www .j a v a 2 s. c o m */ private void btnSelectNwnDirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectNwnDirActionPerformed JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new java.io.File(".")); fc.setDialogTitle("NWN Updater"); fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fc.setAcceptAllFileFilterUsed(false); int returnVal = fc.showOpenDialog(txtNwnDir); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); txtNwnDir.setText(file.getAbsolutePath()); } }
From source file:bridge.toolkit.ControllerJFrame.java
private void ResourceBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) { ResourceFileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = ResourceFileChooser.showOpenDialog(ControllerJFrame.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = ResourceFileChooser.getSelectedFile(); ResourceField.setText(file.getAbsolutePath()); }/* ww w . j a va 2 s. c o m*/ }
From source file:de.evaluationtool.gui.EvaluationFrameActionListener.java
private void loadReference() throws Exception { JFileChooser chooser = new JFileChooser("Please choose a reference file or directory."); chooser.setCurrentDirectory(frame.defaultDirectory); // TODO: detect if all directory formats are not readable and in this case dont allow directory opening chooser.setFileSelectionMode(// w ww . ja v a 2 s .c o m ReferenceFormats.REFERENCE_FORMATS.directoryFormats.isEmpty() ? JFileChooser.FILES_ONLY : JFileChooser.FILES_AND_DIRECTORIES); for (ReferenceFormat format : ReferenceFormats.REFERENCE_FORMATS.readableFormats) { chooser.addChoosableFileFilter( new FilesystemFilter(format.getFileExtension(), format.getDescription())); } chooser.setAcceptAllFileFilterUsed(true); int returnVal = chooser.showOpenDialog(frame); if (returnVal != JFileChooser.APPROVE_OPTION) { return; } ReferenceFormat format = null; System.out.print("Loading..."); frame.setTitle("Loading..."); File f = chooser.getSelectedFile(); Collection<ReferenceFormat> formats; if (f.isDirectory()) { formats = ReferenceFormats.REFERENCE_FORMATS.directoryFormats; } else { formats = ReferenceFormats.REFERENCE_FORMATS.extensionToFormats .get(f.getName().substring(f.getName().lastIndexOf(".") + 1)); } if (formats == null || formats.isEmpty()) { throw new Exception("No format available that can read files with the " + f.getName().substring(f.getName().lastIndexOf(".") + 1) + " extension."); } if (formats.size() == 1) { format = formats.iterator().next(); } else { format = formatChooser(formats); } if (format == null) { return; } Reference reference = format.readReference(chooser.getSelectedFile(), true, frame.loadLimit); if (!reference.links.isEmpty()) { Link firstLink = reference.links.iterator().next(); frame.dataSourceName1 = EvaluationFrame.getProbableDatasourceName(firstLink.uris.first); frame.dataSourceName2 = EvaluationFrame.getProbableDatasourceName(firstLink.uris.second); } frame.setReference(reference); //frame.loadPositiveNegativeNT(chooser.getSelectedFile()); System.out.println("loading finished, " + reference.links.size() + " links loaded."); }