Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Save {
- ObjectOutputStream oos = null;
- FileOutputStream fout = null;
- int counter =1;
- LoadGame object;
- ArrayList<LoadGame> lgClass = new ArrayList<LoadGame>();
- public void saveTheData(ArrayList<Player> playerArray , int activePlayer) {
- try {
- System.out.println("test");
- String inputValue = JOptionPane.showInputDialog("Please enter the name of your save game");
- FileOutputStream fout = new FileOutputStream("(Save game) "+counter+ inputValue + ".ser", true);
- ObjectOutputStream oos = new ObjectOutputStream(fout);
- oos.writeObject(playerArray);
- oos.writeObject(activePlayer);
- object = new LoadGame(playerArray,activePlayer);
- JOptionPane.showMessageDialog (null, "Your save game name is "+ inputValue, "Save game", JOptionPane.INFORMATION_MESSAGE);
- counter++;
- oos.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement