Lab6 #8
@ -20,8 +20,8 @@ public class ExtensionDrawingShip {
|
||||
return "GRAY";
|
||||
if(col.equals(Color.BLACK))
|
||||
return "BLACK";
|
||||
if(col.equals(Color.PINK))
|
||||
return "PINK";
|
||||
if(col.equals(Color.MAGENTA))
|
||||
return "MAGENTA";
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ import drawing_objects.*;
|
||||
import generics.*;
|
||||
import movement_strategy.*;
|
||||
|
||||
class TxtSaveFilter extends FileFilter {
|
||||
class TxtFilter extends FileFilter {
|
||||
@Override
|
||||
public boolean accept(File f) {
|
||||
if (f.isDirectory()) {
|
||||
@ -228,7 +228,7 @@ public class FrameShipsCollection extends JFrame {
|
||||
}
|
||||
private void saveFile(){
|
||||
JFileChooser fc = new JFileChooser("C:\\Users\\user\\Documents");
|
||||
fc.addChoosableFileFilter(new TxtSaveFilter());
|
||||
fc.addChoosableFileFilter(new TxtFilter());
|
||||
int retrieval = fc.showSaveDialog(null);
|
||||
if (retrieval == JFileChooser.APPROVE_OPTION) {
|
||||
File file = new File(fc.getSelectedFile() + "." + "txt");
|
||||
@ -241,7 +241,7 @@ public class FrameShipsCollection extends JFrame {
|
||||
}
|
||||
private void saveSet(){
|
||||
JFileChooser fc = new JFileChooser("C:\\Users\\user\\Documents");
|
||||
fc.addChoosableFileFilter(new TxtSaveFilter());
|
||||
fc.addChoosableFileFilter(new TxtFilter());
|
||||
int retrieval = fc.showSaveDialog(null);
|
||||
if (retrieval == JFileChooser.APPROVE_OPTION) {
|
||||
File file = new File(fc.getSelectedFile() + "." + "txt");
|
||||
|
@ -109,7 +109,7 @@ public class ShipsGenericStorage {
|
||||
var strs = bufferTextFromFile.toString().split("\n");
|
||||
if(strs.length == 0)
|
||||
return false;
|
||||
if (!strs[0].startsWith("ShipCollection"))
|
||||
if (!strs[0].startsWith("ShipsCollection"))
|
||||
return false;
|
||||
String collectionName = strs[1];
|
||||
ShipsGenericCollection<DrawingShip, DrawingObjectShip> collection = getCollection(collectionName);
|
||||
|
Loading…
Reference in New Issue
Block a user