Готовая лабораторная работа 3

This commit is contained in:
Никита Белянин 2023-11-12 15:55:05 +04:00
parent 4fa99338a4
commit 3707bb2cab
2 changed files with 5 additions and 8 deletions

View File

@ -37,7 +37,7 @@ public class DrawingArmoVehicle {
OrnamentsForm.setDigit(_numWheel); OrnamentsForm.setDigit(_numWheel);
} }
public DrawingArmoVehicle(EntityArmoVehicle vehicle, IOrnamentForm ornamentsForm, int width, int height) { protected DrawingArmoVehicle(EntityArmoVehicle vehicle, IOrnamentForm ornamentsForm, int width, int height) {
if (height < _pictureHeight || width < _pictureWidth) if (height < _pictureHeight || width < _pictureWidth)
return; return;
_pictureWidth = width; _pictureWidth = width;

View File

@ -3,9 +3,8 @@ import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
public class FormTankCollection { public class FormTankCollection {
private class Canvas extends JComponent{ private class Canvas extends JComponent {
public TanksGenericCollections<DrawingArmoVehicle, DrawingObjectTank> _tank; public TanksGenericCollections<DrawingArmoVehicle, DrawingObjectTank> _tank;
public Canvas() { public Canvas() {
} }
@ -42,8 +41,7 @@ public class FormTankCollection {
if (_tank.Add(form._drawingTank) != -1) { if (_tank.Add(form._drawingTank) != -1) {
JOptionPane.showMessageDialog(null, "Объект добавлен", "Информация", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, "Объект добавлен", "Информация", JOptionPane.INFORMATION_MESSAGE);
Draw(); Draw();
} } else {
else {
JOptionPane.showMessageDialog(null, "Не удалось добавить объект", "Информация", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, "Не удалось добавить объект", "Информация", JOptionPane.INFORMATION_MESSAGE);
} }
form.Frame.dispose(); form.Frame.dispose();
@ -76,8 +74,7 @@ public class FormTankCollection {
if (_tank.remove(pos) != null) { if (_tank.remove(pos) != null) {
JOptionPane.showMessageDialog(null, "Объект удален", "Информация", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, "Объект удален", "Информация", JOptionPane.INFORMATION_MESSAGE);
Draw(); Draw();
} } else {
else {
JOptionPane.showMessageDialog(null, "Не удалось удалить объект", "Информация", JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, "Не удалось удалить объект", "Информация", JOptionPane.INFORMATION_MESSAGE);
} }
} }
@ -96,7 +93,7 @@ public class FormTankCollection {
JButton toFormTankGenerate = new JButton("Генерировать технику"); JButton toFormTankGenerate = new JButton("Генерировать технику");
toFormTankGenerate.addActionListener( toFormTankGenerate.addActionListener(
new ActionListener() { new ActionListener() {
public void actionPerformed(ActionEvent e){ public void actionPerformed(ActionEvent e) {
FormTankGenerate formTankGenerate = new FormTankGenerate(); FormTankGenerate formTankGenerate = new FormTankGenerate();
} }
} }