PIbd-23. Zakharov R.A. Lab work 05 #6

Closed
Zakharov_Rostislav wants to merge 10 commits from Lab5 into Lab4
3 changed files with 6 additions and 6 deletions
Showing only changes of commit afaed7e316 - Show all commits

View File

@ -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;
}

View File

@ -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");

View File

@ -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);