lab6 some minor fixes

This commit is contained in:
Zakharov_Rostislav 2023-12-20 20:03:43 +04:00
parent 74284dde17
commit afaed7e316
3 changed files with 6 additions and 6 deletions

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