diff --git a/.idea/AircraftCarrier_Hard.iml b/.idea/AircraftCarrier_Hard.iml
index 43191f2..5c48835 100644
--- a/.idea/AircraftCarrier_Hard.iml
+++ b/.idea/AircraftCarrier_Hard.iml
@@ -7,6 +7,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/messages b/messages
deleted file mode 100644
index 711e221..0000000
--- a/messages
+++ /dev/null
@@ -1,8 +0,0 @@
-2022-12-14 00:20:19 INFO FormMapWithSetTractorsGeneric:195 - Переход на карту: 1
-2022-12-14 00:20:19 INFO FormMapWithSetTractorsGeneric:228 - Добавлена карта: 1
- INFO FormMapWithSetTractorsGeneric:195 - Переход на карту: 1 2022-12-14
- INFO FormMapWithSetTractorsGeneric:228 - Добавлена карта: 1 2022-12-14
- INFO FormMapWithSetTractorsGeneric:195 - Переход на карту: 1 2022-12-14
- INFO FormMapWithSetTractorsGeneric:228 - Добавлена карта: 1 2022-12-14
- INFO FormMapWithSetTractorsGeneric:195 - Переход на карту: 1 14-12-2022
- INFO FormMapWithSetTractorsGeneric:228 - Добавлена карта: 1 14-12-2022
diff --git a/src/FormMapWithSetWarships.form b/src/FormMapWithSetWarships.form
index d727893..a3e5af9 100644
--- a/src/FormMapWithSetWarships.form
+++ b/src/FormMapWithSetWarships.form
@@ -3,7 +3,7 @@
-
+
diff --git a/src/FormMapWithSetWarships.java b/src/FormMapWithSetWarships.java
index 52b1b82..68f7a69 100644
--- a/src/FormMapWithSetWarships.java
+++ b/src/FormMapWithSetWarships.java
@@ -7,7 +7,7 @@ import java.io.File;
import java.util.HashMap;
import java.util.function.Consumer;
-import org.apache.log4j.*;
+import org.apache.log4j.Logger;
public class FormMapWithSetWarships extends JFrame{
private JPanel mainPanel;
private JPanel PictureBox;
@@ -44,6 +44,11 @@ public class FormMapWithSetWarships extends JFrame{
private Logger _logger;
+ public FormMapWithSetWarships(Logger logger){
+ this();
+ this._logger=logger;;
+ }
+
public FormMapWithSetWarships(){
InitializeComponent();
}
@@ -74,10 +79,10 @@ public class FormMapWithSetWarships extends JFrame{
}
private void InitializeComponent(){
- _logger = Logger.getLogger("FormMapWithSetTractorsGeneric");
+
setContentPane(mainPanel);
setTitle("Warship");
- setSize(935, 693);
+ setSize(554, 548);
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setVisible(true);
@@ -192,7 +197,7 @@ public class FormMapWithSetWarships extends JFrame{
if(ListBoxMaps.getSelectedIndex() == -1)
return;
bufferedImage = _mapsCollection.get(ListBoxMaps.getSelectedValue().toString()).ShowSet();
- _logger.log(Level.INFO,"Переход на карту: " + ListBoxMaps.getSelectedValue().toString());
+ _logger.info("Переход на карту "+ListBoxMaps.getSelectedValue());
repaint();
});
diff --git a/src/Main.java b/src/Main.java
index 17772ee..30cfb47 100644
--- a/src/Main.java
+++ b/src/Main.java
@@ -1,5 +1,7 @@
+
+import org.apache.log4j.*;
public class Main {
public static void main(String[] args) {
- new FormMapWithSetWarships();
+ new FormMapWithSetWarships(LogManager.getLogger(Main.class));
}
}
diff --git a/src/MapWithSetWarshipsGeneric.java b/src/MapWithSetWarshipsGeneric.java
index 61d7031..2e54a1e 100644
--- a/src/MapWithSetWarshipsGeneric.java
+++ b/src/MapWithSetWarshipsGeneric.java
@@ -116,14 +116,15 @@ public class MapWithSetWarshipsGeneric implements Iterable{
public int Insert(T warship, int position)
{
- if (position < 0 || position >= _maxCount)
+ if (position < 0 || position >= _maxCount || getCount() >= _maxCount)
throw new StorageOverflowException(_maxCount);
_places.add(position, warship);
return position;
diff --git a/src/log4j.xml b/src/log4j.xml
index b7708ff..782b52b 100644
--- a/src/log4j.xml
+++ b/src/log4j.xml
@@ -1,19 +1,27 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+ [%-5level] %msg (%d{dd.MM.yyyy})%n
+
+
+
+
+
+
+
+ [%-5level] %msg (%d{dd.MM.yyyy})%n
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file