Example usage for javax.swing JFileChooser setDialogTitle

List of usage examples for javax.swing JFileChooser setDialogTitle

Introduction

In this page you can find the example usage for javax.swing JFileChooser setDialogTitle.

Prototype

@BeanProperty(preferred = true, description = "The title of the JFileChooser dialog window.")
public void setDialogTitle(String dialogTitle) 

Source Link

Document

Sets the string that goes in the JFileChooser window's title bar.

Usage

From source file:gui.images.ImageHubExplorer.java

/**
 * This method loads the secondary distances and neighbor sets from the
 * specified files, if available.//  ww  w .j  av a2s .c o m
 *
 * @param evt ActionEvent object.
 */
private void loadSecondaryDistancesItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadSecondaryDistancesItemActionPerformed
    JFileChooser jfc = new JFileChooser(currentDirectory);
    jfc.setDialogTitle("Choose distances file. Neighbor sets will be " + "automatically loaded if available");
    jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    int rVal = jfc.showOpenDialog(ImageHubExplorer.this);
    if (rVal == JFileChooser.APPROVE_OPTION) {
        currentDirectory = jfc.getSelectedFile().getParentFile();
        secondaryDMatFile = jfc.getSelectedFile();
        busyCalculating = true;
        try {
            loadDistancesAndNeighbors(secondaryDMatFile, SECONDARY_METRIC);
        } catch (Exception e) {
            System.err.println(e.getMessage());
        } finally {
            busyCalculating = false;
        }
    }
}

From source file:gui.images.ImageHubExplorer.java

/**
 * This method loads the codebook definition from the specified file.
 *
 * @param evt ActionEvent object.// w  w  w.j a v  a 2s .com
 */
private void loadCodebookItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadCodebookItemActionPerformed
    JFileChooser jfc = new JFileChooser(currentDirectory);
    jfc.setDialogTitle("Load SIFT codebook");
    jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    int rVal = jfc.showOpenDialog(ImageHubExplorer.this);
    if (rVal == JFileChooser.APPROVE_OPTION) {
        currentDirectory = jfc.getSelectedFile().getParentFile();
        File cbFile = jfc.getSelectedFile();
        busyCalculating = true;
        try {
            codebook = new GenericCodeBook();
            codebook.loadCodeBookFromFile(cbFile);
            JOptionPane.showMessageDialog(frameReference, "Load completed");
        } catch (Exception e) {
            System.err.println(e.getMessage());
        } finally {
            busyCalculating = false;
        }
    }
}

From source file:gui.images.ImageHubExplorer.java

/**
 * This method selects and image as the current image by browsing through
 * the image dataset directly and selecting the corresponding image file.
 *
 * @param evt ActionEvent object.//from  w  w  w.j a va  2s.  c  o m
 */
private void selImgPathMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selImgPathMenuItemActionPerformed
    JFileChooser jfc = new JFileChooser(currentDirectory);
    jfc.setDialogTitle("Select an image");
    jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    int rVal = jfc.showOpenDialog(ImageHubExplorer.this);
    if (rVal == JFileChooser.APPROVE_OPTION) {
        currentDirectory = jfc.getSelectedFile().getParentFile();
        File imageFile = jfc.getSelectedFile();
        busyCalculating = true;
        try {
            // Look up the image index in the dataset by retrieving it from
            // the image path map.
            int index = pathIndexMap.get(imageFile.getPath());
            setSelectedImageForIndex(index);
            JOptionPane.showMessageDialog(frameReference, "Selection performed");
        } catch (Exception e) {
            System.err.println(e.getMessage());
        } finally {
            busyCalculating = false;
        }
    }
}

From source file:gui.images.ImageHubExplorer.java

/**
 * Get a screen capture of the MDS data visualization and save the image to
 * a file./*from w  w  w.  j ava2 s.c o m*/
 *
 * @param evt ActionEvent object.
 */
private void mdsScreenCaptureItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mdsScreenCaptureItemActionPerformed
    if (mdsCollectionPanel != null) {
        BufferedImage bufImage = ScreenImage.createImage((JComponent) mdsCollectionPanel);
        try {
            File outFile;
            JFileChooser jfc = new JFileChooser(currentDirectory);
            jfc.setDialogTitle("Select file to save the component image: ");
            jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
            int rVal = jfc.showOpenDialog(ImageHubExplorer.this);
            if (rVal == JFileChooser.APPROVE_OPTION) {
                currentDirectory = jfc.getSelectedFile().getParentFile();
                outFile = jfc.getSelectedFile();
                ImageIO.write(bufImage, "jpg", outFile);
            }
        } catch (Exception e) {
            System.err.println("problem writing file: " + e.getMessage());
        }
    }
}

From source file:gui.images.ImageHubExplorer.java

/**
 * Get a screen capture of the kNN graph visualization and save the image to
 * a file.//ww w  . jav  a  2 s  .c  o m
 *
 * @param evt ActionEvent object.
 */
private void graphScreenCaptureItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_graphScreenCaptureItemActionPerformed
    if (neighborGraphScrollPane != null) {
        BufferedImage bufImage = ScreenImage
                .createImage((JComponent) neighborGraphScrollPane.getViewport().getComponent(0));
        try {
            File outFile;
            JFileChooser jfc = new JFileChooser(currentDirectory);
            jfc.setDialogTitle("Select file to save the component image: ");
            jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
            int rVal = jfc.showOpenDialog(ImageHubExplorer.this);
            if (rVal == JFileChooser.APPROVE_OPTION) {
                currentDirectory = jfc.getSelectedFile().getParentFile();
                outFile = jfc.getSelectedFile();
                ImageIO.write(bufImage, "jpg", outFile);
            }
        } catch (Exception e) {
            System.err.println("problem writing file: " + e.getMessage());
        }
    }
}

From source file:gui.images.ImageHubExplorer.java

/**
 * Select an image for the image query and extract its features.
 *
 * @param evt ActionEvent object.//from   www . j a  va2  s  . co  m
 */
private void imageBrowseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imageBrowseButtonActionPerformed
    JFileChooser jfc = new JFileChooser(currentDirectory);
    jfc.setDialogTitle("Select Image Query");
    jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    int rVal = jfc.showOpenDialog(ImageHubExplorer.this);
    if (rVal == JFileChooser.APPROVE_OPTION) {
        currentDirectory = jfc.getSelectedFile().getParentFile();
        try {
            File imageFile = jfc.getSelectedFile();
            queryImage = ImageIO.read(imageFile);
            queryImagePanel.setImage(queryImage);
            queryImagePanel.revalidate();
            queryImagePanel.repaint();
            if (codebook == null) {
                // If the codebook has not been loaded, it is impossible to
                // gemerate the quantized representation.
                JOptionPane.showMessageDialog(frameReference, "First load the codebook", "Error message",
                        JOptionPane.ERROR_MESSAGE);
                return;
            }
            String imgName = imageFile.getName();
            int pointIndex = imgName.lastIndexOf('.');
            String shortName = null;
            if (pointIndex != -1) {
                shortName = imgName.substring(0, pointIndex);
                shortName += ".pgm";
            } else {
                shortName = shortName + ".pgm";
            }
            // Generate the PGM file for SiftWin SIFT feature extraction.
            File pgmFile = new File(workspace, "tmp" + File.separator + shortName);
            File siftTempFile = new File(workspace, "tmp" + File.separator + "siftTemp.key");
            ConvertJPGToPGM.convertFile(imageFile, pgmFile);
            SiftUtil.siftFile(pgmFile, siftTempFile, "");
            pgmFile.delete();
            // Load the extracted SIFT features.
            queryImageLFeat = SiftUtil.importFeaturesFromSift(siftTempFile);
            DataInstance queryImageRepAlmost = codebook.getDistributionForImageRepresentation(queryImageLFeat,
                    imageFile.getPath());
            // Get the color histogram.
            ColorHistogramVector cHist = new ColorHistogramVector();
            cHist.populateFromImage(queryImage, imgName);
            queryImageRep = new DataInstance();
            queryImageRep.fAttr = new float[queryImageRepAlmost.getNumFAtt() + cHist.getNumFAtt()];
            queryImageRep.iAttr = new int[queryImageRepAlmost.getNumIAtt()];
            queryImageRep.sAttr = new String[queryImageRepAlmost.getNumNAtt()];
            System.arraycopy(cHist.fAttr, 0, queryImageRep.fAttr, 0, cHist.getNumFAtt());
            for (int i = 0; i < queryImageRepAlmost.getNumFAtt(); i++) {
                queryImageRep.fAttr[i + cHist.getNumFAtt()] = queryImageRepAlmost.fAttr[i];
                if (queryImageRep.iAttr != null && queryImageRepAlmost.iAttr != null) {
                    queryImageRep.iAttr[i] = queryImageRepAlmost.iAttr[i];
                }
                if (queryImageRep.sAttr != null && queryImageRepAlmost.sAttr != null) {
                    queryImageRep.sAttr[i] = queryImageRepAlmost.sAttr[i];
                }
            }
            // Reset the neighbor lists and the predictions in the query panel.
            queryNNPanel.removeAll();
            queryNNPanel.revalidate();
            queryNNPanel.repaint();

            classifierPredictionsPanel.removeAll();
            classifierPredictionsPanel.revalidate();
            classifierPredictionsPanel.repaint();
        } catch (Exception e) {
            System.err.println(e.getMessage());
        }
    }
}

From source file:gui.images.ImageHubExplorer.java

/**
 * This method loads the codebook profile from a file that contains the
 * visual word occurrence probabilities per class and is used for visual
 * word utility estimation./*  w ww .j  av  a 2 s .  c om*/
 *
 * @param evt ActionEvent object.
 */
private void loadCodebookProfileMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadCodebookProfileMenuItemActionPerformed
    BufferedReader br;
    JFileChooser jfc = new JFileChooser(currentDirectory);
    if (codebook == null) {
        JOptionPane.showMessageDialog(this, "no codebook loaded", "Error", JOptionPane.ERROR_MESSAGE);
        return;
    }
    jfc.setDialogTitle("Load Codebook Profiles: ");
    jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
    int rVal = jfc.showOpenDialog(ImageHubExplorer.this);
    if (rVal == JFileChooser.APPROVE_OPTION) {
        currentDirectory = jfc.getSelectedFile().getParentFile();
        codebookProfileFile = jfc.getSelectedFile();
        try {
            // Load the codebook profiles.
            br = new BufferedReader(new InputStreamReader(new FileInputStream(codebookProfileFile)));
            int size = Integer.parseInt(br.readLine());
            if (size != codebook.getSize()) {
                throw new Exception("codebook profile size not equal to " + "codebook size");
            }
            codebookProfiles = new double[codebook.getSize()][numClasses];
            String line;
            String[] lineItems;
            float[] codeClassMax = new float[codebook.getSize()];
            float[] codeClassSums = new float[codebook.getSize()];
            for (int i = 0; i < size; i++) {
                line = br.readLine();
                lineItems = line.split(",");
                if (lineItems.length != numClasses) {
                    throw new Exception("codebook profile class number " + "inappropriate " + lineItems.length
                            + " instead of " + numClasses);
                }
                // Keep track of the stats.
                codeClassMax[i] = 0;
                codeClassSums[i] = 0;
                for (int c = 0; c < numClasses; c++) {
                    codebookProfiles[i][c] = Double.parseDouble(lineItems[c]);
                    codeClassMax[i] = (float) Math.max(codeClassMax[i], codebookProfiles[i][c]);
                    codeClassSums[i] += codebookProfiles[i][c];
                }
            }
            // Calculate the goodness of each visual word.
            codebookGoodness = new float[codebook.getSize()];
            for (int codeIndex = 0; codeIndex < codebookGoodness.length; codeIndex++) {
                if (codeClassSums[codeIndex] > 0) {
                    codebookGoodness[codeIndex] = codeClassMax[codeIndex] / codeClassSums[codeIndex];
                } else {
                    codebookGoodness[codeIndex] = 0;
                }
            }
            float maxGoodness = ArrayUtil.max(codebookGoodness);
            float minGoodness = ArrayUtil.min(codebookGoodness);
            for (int codeIndex = 0; codeIndex < codebookGoodness.length; codeIndex++) {
                if ((maxGoodness - minGoodness) > 0) {
                    codebookGoodness[codeIndex] = (codebookGoodness[codeIndex] - minGoodness)
                            / (maxGoodness - minGoodness);
                }
            }
            codebookProfPanels = new CodebookVectorProfilePanel[codebook.getSize()];
            for (int cInd = 0; cInd < codebook.getSize(); cInd++) {
                CodebookVectorProfilePanel cProfPanel = new CodebookVectorProfilePanel();
                cProfPanel.setResults(codebookProfiles[cInd], cInd, classColors, classNames);
                cProfPanel.setPreferredSize(new Dimension(120, 120));
                cProfPanel.setMinimumSize(new Dimension(120, 120));
                cProfPanel.setMaximumSize(new Dimension(120, 120));
                codebookProfPanels[cInd] = cProfPanel;
            }
            JOptionPane.showMessageDialog(frameReference, "Load completed");
        } catch (Exception e) {
            System.err.println(e.getMessage());
            codebookProfiles = null;
            codebookGoodness = null;
        }
    }
}

From source file:ru.apertum.qsystem.client.forms.FAdmin.java

private void buttonExportToCSVActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonExportToCSVActionPerformed
        final JFileChooser fc = new JFileChooser();
        fc.setDialogTitle(getLocaleMessage("save.statictic"));
        fc.setFileFilter(new FileFilter() {

            @Override//from w  w  w . java  2s.  com
            public boolean accept(File f) {
                return !f.isFile() || f.getAbsolutePath().toLowerCase().endsWith(".csv");
            }

            @Override
            public String getDescription() {
                return getLocaleMessage("files.type.csv");
            }
        });
        //fc.setCurrentDirectory(new File("config"));
        //fc.setSelectedFile(new File(configuration.getSystemName()));
        fc.setDialogType(JFileChooser.SAVE_DIALOG);
        if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
            final File file;
            //This is where a real application would open the file.
            if (!fc.getSelectedFile().getAbsolutePath().toLowerCase().endsWith(".csv")) {
                file = new File(fc.getSelectedFile().getAbsoluteFile() + ".csv");
            } else {
                file = fc.getSelectedFile();
            }

            Spring.getInstance().getHt().getSessionFactory().openSession().doWork((Connection connection) -> {
                final GregorianCalendar gc = new GregorianCalendar();
                gc.setTime(dateChooserStartCsv.getDate());
                gc.set(GregorianCalendar.HOUR_OF_DAY, 0);
                gc.set(GregorianCalendar.MINUTE, 0);
                gc.set(GregorianCalendar.SECOND, 0);
                gc.set(GregorianCalendar.MILLISECOND, 0);
                final String std = Uses.format_for_rep.format(gc.getTime());
                gc.setTime(dateChooserFinishCsv.getDate());
                gc.set(GregorianCalendar.HOUR_OF_DAY, 0);
                gc.set(GregorianCalendar.MINUTE, 0);
                gc.set(GregorianCalendar.SECOND, 0);
                gc.set(GregorianCalendar.MILLISECOND, 0);
                gc.add(GregorianCalendar.HOUR, 24);
                final String find = Uses.format_for_rep.format(gc.getTime());
                final String sql = " SELECT " + "    s.client_id as id, "
                        + "    concat(c.service_prefix , c.number) as num, " + "    c.input_data as inp,  "
                        + "    DATE_FORMAT(s.client_stand_time, '%d.%m.%y %H:%i') as stnd, "
                        + "    sv.name as srv, " + "    DATE_FORMAT(s.user_start_time, '%d.%m.%y %H:%i') as strt, "
                        + "    DATE_FORMAT(s.user_finish_time, '%d.%m.%y %H:%i') as fin, " + "    u.name as usr, "
                        + "    s.client_wait_period as wt, " + "    s.user_work_period as wrk, "
                        + "    IFNULL(r.name, '') as res "
                        + " FROM statistic s left join results r on s.results_id=r.id, clients c, users u, services sv "
                        + " WHERE s.client_id=c.id and s.user_id=u.id and s.service_id=sv.id "
                        + "    and s.client_stand_time>='" + std + "' and s.client_stand_time<='" + find + "'";
                try (ResultSet set = connection.createStatement().executeQuery(sql)) {
                    final Writer writer;
                    try {
                        writer = new OutputStreamWriter(new FileOutputStream(file), "cp1251").append("");
                        writer.append("");
                        writer.append(cbSeparateCSV.getSelectedItem().toString());
                        writer.append(getLocaleMessage("csv.number"));
                        writer.append(cbSeparateCSV.getSelectedItem().toString());
                        writer.append(getLocaleMessage("csv.data"));
                        writer.append(cbSeparateCSV.getSelectedItem().toString());
                        writer.append(getLocaleMessage("csv.stand_time"));
                        writer.append(cbSeparateCSV.getSelectedItem().toString());
                        writer.append(getLocaleMessage("csv.service_name"));
                        writer.append(cbSeparateCSV.getSelectedItem().toString());
                        writer.append(getLocaleMessage("csv.start_time"));
                        writer.append(cbSeparateCSV.getSelectedItem().toString());
                        writer.append(getLocaleMessage("csv.finish_time"));
                        writer.append(cbSeparateCSV.getSelectedItem().toString());
                        writer.append(getLocaleMessage("csv.user"));
                        writer.append(cbSeparateCSV.getSelectedItem().toString());
                        writer.append(getLocaleMessage("csv.wait"));
                        writer.append(cbSeparateCSV.getSelectedItem().toString());
                        writer.append(getLocaleMessage("csv.work"));
                        writer.append(cbSeparateCSV.getSelectedItem().toString());
                        writer.append(getLocaleMessage("csv.result"));
                        writer.append('\n');

                        while (set.next()) {
                            writer.append(set.getString("id"));
                            writer.append(cbSeparateCSV.getSelectedItem().toString());
                            writer.append(set.getString("num"));
                            writer.append(cbSeparateCSV.getSelectedItem().toString());
                            writer.append(set.getString("inp"));
                            writer.append(cbSeparateCSV.getSelectedItem().toString());
                            writer.append(set.getString("stnd"));
                            writer.append(cbSeparateCSV.getSelectedItem().toString());
                            writer.append(
                                    set.getString("srv").replace(cbSeparateCSV.getSelectedItem().toString(), " "));
                            writer.append(cbSeparateCSV.getSelectedItem().toString());
                            writer.append(set.getString("strt"));
                            writer.append(cbSeparateCSV.getSelectedItem().toString());
                            writer.append(set.getString("fin"));
                            writer.append(cbSeparateCSV.getSelectedItem().toString());
                            writer.append(set.getString("usr"));
                            writer.append(cbSeparateCSV.getSelectedItem().toString());
                            writer.append(set.getString("wt"));
                            writer.append(cbSeparateCSV.getSelectedItem().toString());
                            writer.append(set.getString("wrk"));
                            writer.append(cbSeparateCSV.getSelectedItem().toString());
                            writer.append(set.getString("res"));
                            writer.append('\n');
                        }
                        //generate whatever data you want

                        writer.flush();
                        writer.close();
                    } catch (IOException ex) {
                        throw new ClientException(ex);
                    }
                }
                JOptionPane.showMessageDialog(fc, getLocaleMessage("stat.saved"), getLocaleMessage("stat.saving"),
                        JOptionPane.INFORMATION_MESSAGE);
            });

        }
    }

From source file:InternalFrame.InternalFrameproject.java

private void loadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadActionPerformed

    String userhome = System.getProperty(constants.getProgrampath());
    JFileChooser chooser = new JFileChooser(userhome + "\\" + constants.getProject_input_folder());
    FileNameExtensionFilter txtfilter = new FileNameExtensionFilter("emft files (*Emft)", "Emft");
    chooser.setDialogTitle(language_internal_frame.LangLabel(constants.getLanguage_option(), 7));
    chooser.setFileFilter(txtfilter);//from www.j ava2s.  com
    chooser.showOpenDialog(null);

    File f = chooser.getSelectedFile();
    File subor = new File(f.getParent() + "\\" + f.getName());

    int pocet_Vysok = 0;
    try {
        Scanner input = new Scanner(subor);

        basicInfoPanel.jTextField_mano.setText(input.nextLine());
        basicInfoPanel.jTextField_mano_projektu.setText(input.nextLine());
        basicSettingsPanel.jTextField_A.setText(String.valueOf(input.nextDouble()));
        basicSettingsPanel.jTextField_Z.setText(String.valueOf(input.nextDouble()));
        basicSettingsPanel.jTextField_H.setText(String.valueOf(input.nextDouble()));
        basicSettingsPanel.jTextField_krok.setText(String.valueOf(input.nextDouble()));
        basicSettingsPanel.jTextField_krok_pozorovatela.setText(String.valueOf(input.nextDouble()));
        input.nextLine();

        pocet_Vysok = input.nextInt();
        input.nextLine();
        int rowCount = observerPanel1.DTMTable.getRowCount();// odsrrani riadky z DTM table
        for (int i = rowCount - 1; i >= 0; i--) {
            observerPanel1.isListener = false;
            observerPanel1.DTMTable.removeRow(i);
            observerPanel1.isListener = true;
        }
        for (int i = 0; i < pocet_Vysok; i++) {
            observerPanel1.isListener = false;
            observerPanel1.DTMTable.addRow(new Object[] { input.nextLine() });
            observerPanel1.isListener = true;
        }

        observerPanel1.Table.selectAll(); // ozna? potom vetky stplce

        observerPanel1.isListener = false;
        observerPanel1.DTMTable.addRow(new Object[0]);
        observerPanel1.isListener = true;

        int pocet_catenary_riadkov = input.nextInt();
        input.nextLine();
        rowCount = catenaryPanel1.DTMTable.getRowCount();// odsrrani riadky z DTM table
        for (int i = rowCount - 1; i >= 0; i--) {
            catenaryPanel1.isListener = false;
            catenaryPanel1.DTMTable.removeRow(i);
            catenaryPanel1.isListener = true;
        }
        for (int i = 0; i < pocet_catenary_riadkov; i++) {
            catenaryPanel1.isListener = false;

            double V1 = input.nextDouble();
            double V2 = input.nextDouble();
            double I1 = input.nextDouble();
            double I2 = input.nextDouble();
            double W1 = input.nextDouble();
            double W2 = input.nextDouble();
            double X1 = input.nextDouble();
            double X2 = input.nextDouble();
            int zvazok = input.nextInt();
            double alpha = input.nextDouble();
            double d = input.nextDouble();
            int CH = input.nextInt();
            boolean ch = false;
            if (CH == 1) {
                ch = true;
            }
            double val = input.nextDouble();
            double r = input.nextDouble();
            double U = input.nextDouble();
            double I = input.nextDouble();
            double Phi = input.nextDouble();
            int pocitaj = input.nextInt();
            String lano = input.nextLine();
            lano = lano.substring(1);
            boolean poc = false;
            if (pocitaj == 1) {
                poc = true;
            }

            // najdi lano v databaze
            int index = 0;
            for (int j = 0; j < catenaryPanel1.getConductor_Name_Matrix().size(); j++) {

                if (lano.equals(catenaryPanel1.getConductor_Name_Matrix().get(j))) {
                    index = j;
                }
            }

            catenaryPanel1.DTMTable.addRow(new Object[] { V1, V2, I1, I2, W1, W2, X1, X2, zvazok, alpha, d, ch,
                    val, r, U, I, Phi, "-", "-", "-", poc, false, lano });
            catenaryPanel1.isListener = true;
        }
        catenaryPanel1.isListener = false;
        catenaryPanel1.DTMTable.addRow(new Object[0]);
        catenaryPanel1.isListener = true;

    } catch (FileNotFoundException ex) {
        Logger.getLogger(terenmodel_jDialog.class.getName()).log(Level.SEVERE, null, ex);

    }

}

From source file:InternalFrame.InternalFrameproject.java

private void saveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveActionPerformed
    String userhome = System.getProperty(constants.getProgrampath()); //userhome is home folder of program

    // ak je zadan pec lokaciakde uklada tak tam ak nide default prie?ion kde existuje
    JFileChooser chooser = new JFileChooser(userhome + "\\" + constants.getProject_input_folder());

    //key files are stored in resources
    FileNameExtensionFilter txtfilter = new FileNameExtensionFilter("emft files (*.Emft)", "Emft"); // whitch type of files are we looking for
    chooser.setDialogTitle(language_internal_frame.LangLabel(constants.getLanguage_option(), 9)); // title for Jfile chooser window
    chooser.setFileFilter(txtfilter); // Txt filter for choosing file
    chooser.showSaveDialog(null);//from w  w w.  ja  v  a2  s  .c  om
    File f = chooser.getSelectedFile();
    String project_filename = f.getName() + ".Emft";
    String project_filepath = f.getParent();

    File subor = new File(project_filepath + "\\" + project_filename);

    PrintWriter fw;
    try {
        fw = new PrintWriter(subor);

        fw.println(basicInfoPanel.jTextField_mano.getText());
        fw.println(basicInfoPanel.jTextField_mano_projektu.getText());
        fw.println(basicSettingsPanel.jTextField_A.getText() + " " + basicSettingsPanel.jTextField_Z.getText()
                + " " + basicSettingsPanel.jTextField_H.getText() + " "
                + basicSettingsPanel.jTextField_krok.getText() + " "
                + basicSettingsPanel.jTextField_krok_pozorovatela.getText() + " ");
        fw.println(observerPanel1.Table.getRowCount() - 1);

        for (int i = 0; i < observerPanel1.Table.getRowCount() - 1; i++) {

            fw.println(observerPanel1.DTMTable.getValueAt(i, 0));

        }

        fw.println(catenaryPanel1.Table.getRowCount() - 1);

        for (int i = 0; i < catenaryPanel1.Table.getRowCount() - 1; i++) {

            double V1 = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 0));
            double V2 = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 1));
            double I1 = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 2));
            double I2 = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 3));
            double W1 = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 4));
            double W2 = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 5));
            double X1 = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 6));
            double X2 = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 7));
            int zvazok = (int) help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 8));
            double alpha = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 9));
            double d = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 10));
            int CH = 0;
            boolean ch = help.Object_To_Boolean(catenaryPanel1.DTMTable.getValueAt(i, 11));
            if (ch == true) {
                CH = 1;
            }
            double val = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 12));
            double r = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 13));
            double U = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 14));
            double I = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 15));
            double Phi = help.Object_To_double(catenaryPanel1.DTMTable.getValueAt(i, 16));
            int poc = 0;
            boolean pocitaj = help.Object_To_Boolean(catenaryPanel1.DTMTable.getValueAt(i, 20));
            if (pocitaj == true) {
                poc = 1;
            }

            String lano = String.valueOf(catenaryPanel1.DTMTable.getValueAt(i, 22));

            fw.println(V1 + " " + V2 + " " + I1 + " " + I2 + " " + W1 + " " + W2 + " " + X1 + " " + X2 + " "
                    + zvazok + " " + alpha + " " + d + " " + CH + " " + val + " " + r + " " + U + " " + I + " "
                    + Phi + " " + poc + " " + lano);

        }

        Date todaysDate = new Date();
        DateFormat df2 = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
        fw.println("END of file");
        fw.println("time of creation :" + df2.format(todaysDate));
        fw.close();

    } catch (FileNotFoundException ex) {
        Logger.getLogger(InternalFrameproject.class.getName()).log(Level.SEVERE, null, ex);
    }
}