Advertisement
Guest User

python

a guest
Apr 28th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. public class Save {
  2. ObjectOutputStream oos = null;
  3. FileOutputStream fout = null;
  4. int counter =1;
  5. LoadGame object;
  6. ArrayList<LoadGame> lgClass = new ArrayList<LoadGame>();
  7.  
  8. public void saveTheData(ArrayList<Player> playerArray , int activePlayer) {
  9. try {
  10. System.out.println("test");
  11. String inputValue = JOptionPane.showInputDialog("Please enter the name of your save game");
  12. FileOutputStream fout = new FileOutputStream("(Save game) "+counter+ inputValue + ".ser", true);
  13. ObjectOutputStream oos = new ObjectOutputStream(fout);
  14. oos.writeObject(playerArray);
  15. oos.writeObject(activePlayer);
  16. object = new LoadGame(playerArray,activePlayer);
  17.  
  18. JOptionPane.showMessageDialog (null, "Your save game name is "+ inputValue, "Save game", JOptionPane.INFORMATION_MESSAGE);
  19. counter++;
  20. oos.close();
  21. } catch (Exception e) {
  22. e.printStackTrace();
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement