Search in sources :

Example 1 with SpjFile

use of jmri.jmrix.loconet.spjfile.SpjFile in project JMRI by JMRI.

the class LoaderPane method doRead.

void doRead() {
    if (inputFileName.getText().equals("")) {
        JOptionPane.showMessageDialog(this, res.getString("ErrorNoInputFile"), res.getString("ErrorTitle"), JOptionPane.ERROR_MESSAGE);
        return;
    }
    // force load, verify disabled in case read fails
    loadButton.setEnabled(false);
    loadButton.setToolTipText(res.getString("TipLoadDisabled"));
    try {
        file = new SpjFile(chooser.getSelectedFile());
        file.read();
    } catch (FileNotFoundException f) {
        JOptionPane.showMessageDialog(this, res.getString("ErrorFileNotFound"), res.getString("ErrorTitle"), JOptionPane.ERROR_MESSAGE);
        return;
    } catch (IOException f) {
        JOptionPane.showMessageDialog(this, res.getString("ErrorIOError"), res.getString("ErrorTitle"), JOptionPane.ERROR_MESSAGE);
        return;
    }
    // display contents
    comment.setText(file.getComment());
    // set up for next step
    loadButton.setEnabled(true);
    loadButton.setToolTipText(res.getString("TipLoadEnabled"));
    status.setText(res.getString("StatusDoDownload"));
}
Also used : SpjFile(jmri.jmrix.loconet.spjfile.SpjFile) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 SpjFile (jmri.jmrix.loconet.spjfile.SpjFile)1