Ejemplo n.º 1
0
  void onOpenFileClicked() {
    if (!maybeSave()) {
      return;
    }

    try {
      JFileChooser fc = new JFileChooser();
      FileNameExtensionFilter filter1 =
          new FileNameExtensionFilter(strings.getString("filetype." + EXTENSION), EXTENSION);
      fc.setFileFilter(filter1);

      int rv = fc.showOpenDialog(this);
      if (rv == JFileChooser.APPROVE_OPTION) {
        File file = fc.getSelectedFile();

        Tournament t = new Tournament();
        t.loadFile(file);

        setTournament(file, t);
      }
    } catch (Exception e) {
      JOptionPane.showMessageDialog(
          this, e, strings.getString("main.error_caption"), JOptionPane.ERROR_MESSAGE);
    }
  }