update of MyInterface.java (By the teacher)
This commit is contained in:
parent
015af22129
commit
5ad318256d
|
|
@ -23,6 +23,7 @@ import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
|
||||||
public class MyInterface extends JFrame {
|
public class MyInterface extends JFrame {
|
||||||
|
|
@ -326,7 +327,8 @@ public class MyInterface extends JFrame {
|
||||||
String fileName=SelectFile();
|
String fileName=SelectFile();
|
||||||
if (fileName.length()>0) {
|
if (fileName.length()>0) {
|
||||||
ArrayList<String> content = mySimu.getSaveState();
|
ArrayList<String> content = mySimu.getSaveState();
|
||||||
writeFile(fileName, (String[]) content.toArray());
|
String[] strArr = Arrays.copyOf(content.toArray(), content.toArray().length, String[].class);
|
||||||
|
writeFile(fileName, strArr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -334,7 +336,8 @@ public class MyInterface extends JFrame {
|
||||||
String fileName=SelectFile();
|
String fileName=SelectFile();
|
||||||
if (fileName.length()>0) {
|
if (fileName.length()>0) {
|
||||||
ArrayList<String> content = mySimu.getRule();
|
ArrayList<String> content = mySimu.getRule();
|
||||||
writeFile(fileName, (String[]) content.toArray());
|
String[] strArr = Arrays.copyOf(content.toArray(), content.toArray().length, String[].class);
|
||||||
|
writeFile(fileName, strArr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -342,7 +345,8 @@ public class MyInterface extends JFrame {
|
||||||
String fileName=SelectFile();
|
String fileName=SelectFile();
|
||||||
if (fileName.length()>0) {
|
if (fileName.length()>0) {
|
||||||
ArrayList<String> content = mySimu.getAgentsSave();
|
ArrayList<String> content = mySimu.getAgentsSave();
|
||||||
writeFile(fileName, (String[]) content.toArray());
|
String[] strArr = Arrays.copyOf(content.toArray(), content.toArray().length, String[].class);
|
||||||
|
writeFile(fileName, strArr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue