7 лабораторная(без логгов)
This commit is contained in:
parent
d9c0fbf63c
commit
441001a425
18
.idea/AircraftCarrier_Hard.iml
generated
18
.idea/AircraftCarrier_Hard.iml
generated
@ -7,6 +7,24 @@
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module-library" exported="">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../../../Download/apache-log4j-2.19.0-bin/apache-log4j-2.19.0-bin/log4j-api-2.19.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library" exported="">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../../../Download/apache-log4j-2.19.0-bin/apache-log4j-2.19.0-bin/log4j-core-2.19.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" name="log4j-1.2.17" level="project" />
|
||||
</component>
|
||||
</module>
|
8
messages
8
messages
@ -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
|
@ -3,7 +3,7 @@
|
||||
<grid id="27dc6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="884" height="620"/>
|
||||
<xy x="20" y="20" width="884" height="599"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
|
@ -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();
|
||||
});
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -116,14 +116,15 @@ public class MapWithSetWarshipsGeneric <T extends IDrawingObject,U extends Abstr
|
||||
|
||||
private void DrawWarship(Graphics gr)
|
||||
{
|
||||
int width = _pictureWidth / _placeSizeWidth;
|
||||
int height = _pictureHeight / _placeSizeHeight;
|
||||
int countInLine = _pictureWidth / _placeSizeWidth;
|
||||
int countInColumn = _pictureHeight / _placeSizeHeight;
|
||||
|
||||
int maxDown = (countInColumn - 1) * _placeSizeHeight;
|
||||
for (int i = 0; i < _setWarships.getCount(); i++)
|
||||
{
|
||||
if (_setWarships.Get(i) != null)
|
||||
{
|
||||
_setWarships.Get(i).SetObject(i % width * _placeSizeWidth, ((height - 1 - i / width) * _placeSizeHeight) + 6, _pictureWidth, _pictureHeight);
|
||||
_setWarships.Get(i).SetObject(i % countInLine * _placeSizeWidth, maxDown - i / countInLine * _placeSizeHeight + 7, _pictureWidth, _pictureHeight);
|
||||
_setWarships.Get(i).DrawingObject(gr);
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class SetWarshipsGeneric<T extends Object> implements Iterable<T>{
|
||||
|
||||
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;
|
||||
|
@ -1,19 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE log4j:configuration PUBLIC
|
||||
"-//APACHE//DTD LOG4J 1.2//EN"
|
||||
"http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd">
|
||||
<log4j:configuration debug="false">
|
||||
|
||||
<appender name="FileAppender" class="org.apache.log4j.DailyRollingFileAppender">
|
||||
<param name="File" value="messages"/>
|
||||
<param name="DatePattern" value="'-'yyyy-MM-dd"/>
|
||||
<param name="Encoding" value="utf-8"/>
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value=" %-5p %c{1}:%L - %m %d{dd-MM-yyyy} %n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
<root>
|
||||
<priority value="INFO"/>
|
||||
<appender-ref ref="FileAppender"/>
|
||||
</root>
|
||||
</log4j:configuration>
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<Configuration status="info">
|
||||
<Appenders>
|
||||
<File name="error" fileName="Errors.log" append="true">
|
||||
<PatternLayout>
|
||||
<Pattern>
|
||||
[%-5level] %msg (%d{dd.MM.yyyy})%n
|
||||
</Pattern>
|
||||
</PatternLayout>
|
||||
<ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY"/>
|
||||
</File>
|
||||
<File name="info" fileName="Infos.log" append="true">
|
||||
<PatternLayout>
|
||||
<Pattern>
|
||||
[%-5level] %msg (%d{dd.MM.yyyy})%n
|
||||
</Pattern>
|
||||
</PatternLayout>
|
||||
<ThresholdFilter level="WARN" onMatch="DENY" onMismatch="ACCEPT"/>
|
||||
</File>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="INFO">
|
||||
<AppenderRef ref="info"/>
|
||||
<AppenderRef ref="error"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
Loading…
x
Reference in New Issue
Block a user