Esempio n. 1
0
  /** Close the main frame and all EntryEdit frames and then this frame, then exit. */
  protected void exit() {
    Splash.exitApp();
    //  for(int i=0 ; i<entry_edit_objects.size() ;++i)
    //    entryEditFinished(entry_edit_objects.elementAt(i));

    //  if(filemanager != null)
    //    filemanager.setVisible(false);

    //  setVisible(false);
    //  dispose();
    //  System.gc();
  }
Esempio n. 2
0
    @Override
    public void actionPerformed(ActionEvent arg0) {

      // Get the file
      JFileChooser fc = new JFileChooser(Driver.prefs.get("save_location", ""));
      File f;
      FileNameExtensionFilter filter = new FileNameExtensionFilter("JPokemon Files", "jpkmn");

      fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
      fc.addChoosableFileFilter(filter);

      if (fc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
        f = fc.getSelectedFile();
        try {
          // Make sure the file is of type .jpkmn
          if (!f.getName()
              .substring(f.getName().lastIndexOf('.'), f.getName().length())
              .equalsIgnoreCase(".jpkmn")) {
            showFatalErrorMessage("not type .jpkmn");
          }

          // Store the default save location
          Driver.prefs.put("save_location", f.getAbsolutePath());
          Driver.prefs.flush();

          // Load game
          Scanner scan = new Scanner(f);
          player = Player.fromFile(scan);
          splash.dispose();
          new GameWindow(player);
        } catch (Exception e) {
          e.printStackTrace();
          showFatalErrorMessage("General Error");
        }
      } // End if
    }
Esempio n. 3
0
 @Override
 public void actionPerformed(ActionEvent arg0) {
   splash.dispose();
 }
Esempio n. 4
0
 @Override
 public void actionPerformed(ActionEvent arg0) {
   splash.dispose();
   player.createNew();
   new GameWindow(player);
 }