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"; return "GRAY";
if(col.equals(Color.BLACK)) if(col.equals(Color.BLACK))
return "BLACK"; return "BLACK";
if(col.equals(Color.PINK)) if(col.equals(Color.MAGENTA))
return "PINK"; return "MAGENTA";
return null; return null;
} }

View File

@ -14,7 +14,7 @@ import drawing_objects.*;
import generics.*; import generics.*;
import movement_strategy.*; import movement_strategy.*;
class TxtSaveFilter extends FileFilter { class TxtFilter extends FileFilter {
@Override @Override
public boolean accept(File f) { public boolean accept(File f) {
if (f.isDirectory()) { if (f.isDirectory()) {
@ -228,7 +228,7 @@ public class FrameShipsCollection extends JFrame {
} }
private void saveFile(){ private void saveFile(){
JFileChooser fc = new JFileChooser("C:\\Users\\user\\Documents"); JFileChooser fc = new JFileChooser("C:\\Users\\user\\Documents");
fc.addChoosableFileFilter(new TxtSaveFilter()); fc.addChoosableFileFilter(new TxtFilter());
int retrieval = fc.showSaveDialog(null); int retrieval = fc.showSaveDialog(null);
if (retrieval == JFileChooser.APPROVE_OPTION) { if (retrieval == JFileChooser.APPROVE_OPTION) {
File file = new File(fc.getSelectedFile() + "." + "txt"); File file = new File(fc.getSelectedFile() + "." + "txt");
@ -241,7 +241,7 @@ public class FrameShipsCollection extends JFrame {
} }
private void saveSet(){ private void saveSet(){
JFileChooser fc = new JFileChooser("C:\\Users\\user\\Documents"); JFileChooser fc = new JFileChooser("C:\\Users\\user\\Documents");
fc.addChoosableFileFilter(new TxtSaveFilter()); fc.addChoosableFileFilter(new TxtFilter());
int retrieval = fc.showSaveDialog(null); int retrieval = fc.showSaveDialog(null);
if (retrieval == JFileChooser.APPROVE_OPTION) { if (retrieval == JFileChooser.APPROVE_OPTION) {
File file = new File(fc.getSelectedFile() + "." + "txt"); File file = new File(fc.getSelectedFile() + "." + "txt");

View File

@ -109,7 +109,7 @@ public class ShipsGenericStorage {
var strs = bufferTextFromFile.toString().split("\n"); var strs = bufferTextFromFile.toString().split("\n");
if(strs.length == 0) if(strs.length == 0)
return false; return false;
if (!strs[0].startsWith("ShipCollection")) if (!strs[0].startsWith("ShipsCollection"))
return false; return false;
String collectionName = strs[1]; String collectionName = strs[1];
ShipsGenericCollection<DrawingShip, DrawingObjectShip> collection = getCollection(collectionName); ShipsGenericCollection<DrawingShip, DrawingObjectShip> collection = getCollection(collectionName);