From 968cc81bc82655f5065a9607626d5a9612e218fd Mon Sep 17 00:00:00 2001 From: antoc0der <1@DESKTOP-K1L8ND3> Date: Mon, 27 Nov 2023 10:54:49 +0300 Subject: [PATCH] it is to be... --- src/FormAirplaneCollection.java | 9 ++++----- src/Generics/AirplaneTrashCollection.java | 11 ++++++----- src/Generics/SetGeneric.java | 10 +++++----- src/Main.java | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/FormAirplaneCollection.java b/src/FormAirplaneCollection.java index 5ef8e8e..f9e19ca 100644 --- a/src/FormAirplaneCollection.java +++ b/src/FormAirplaneCollection.java @@ -51,11 +51,11 @@ public class FormAirplaneCollection { listBoxStorages= new JList<>(listBoxModel); scrollPane.setViewportView(listBoxStorages); JButton delStorageButton = new JButton("Удалить набор"); - toolBox.setBounds(623,12, 227, 80); + //toolBox.setBounds(623,12, 227, 80); JFrame collectionFrame = new JFrame(); collectionFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); collectionFrame.setSize(880,497); - //toolBox.setBounds(623, 12, 227, 426); + toolBox.setBounds(623, 12, 227, 426); canv.setBounds(12,12,pictureBoxWidth,pictureBoxHeight); JButton addButton = new JButton("Добавить"); JButton removeButton = new JButton("Удалить"); @@ -116,7 +116,7 @@ public class FormAirplaneCollection { if(listBoxStorages.getSelectedIndex() == -1) { return; } - AirplaneGenericStorage _airplanes = _storage.Get(listBoxStorages.getSelectedValue()); + AirplaneGenericCollection _airplanes = _storage.Get(listBoxStorages.getSelectedValue()); FormAirplaneWithRadar form = new FormAirplaneWithRadar(); form.buttonSelect.addActionListener(new ActionListener() { @Override @@ -147,7 +147,6 @@ public class FormAirplaneCollection { } String tmp = airplaneNumb.getText(); int numb; - try{ numb = Integer.parseInt(tmp); } @@ -170,7 +169,7 @@ public class FormAirplaneCollection { if(listBoxStorages.getSelectedIndex() == -1) { return; } - AirplaneGenericStorage _airplanes = _storage.Get(listBoxStorages.getSelectedValue()); + AirplaneGenericCollection _airplanes = _storage.Get(listBoxStorages.getSelectedValue()); if(_airplanes == null) { return; } diff --git a/src/Generics/AirplaneTrashCollection.java b/src/Generics/AirplaneTrashCollection.java index f8d87db..f6ec6bc 100644 --- a/src/Generics/AirplaneTrashCollection.java +++ b/src/Generics/AirplaneTrashCollection.java @@ -11,18 +11,19 @@ public class AirplaneTrashCollection { _queue = new ArrayDeque<>(); } - public void Push(T monorail){ - _queue.add(monorail); + public void Push(T airplane){ + _queue.add(airplane); } public int GetSize(){ return _queue.size(); } - public void Pop(){ + public DrawningAirplane Pop(){ if(_queue.size() ==0) - return; - _queue.remove(); + return null; + + return _queue.remove(); } public T GetTop(){ diff --git a/src/Generics/SetGeneric.java b/src/Generics/SetGeneric.java index ad69a4e..d27570a 100644 --- a/src/Generics/SetGeneric.java +++ b/src/Generics/SetGeneric.java @@ -10,17 +10,17 @@ public class SetGeneric { _maxCount = count; _places = new ArrayList<>(); } - public boolean Insert(T monorail){ + public boolean Insert(T airplane){ if(_places.size() == _maxCount) return false; - Insert(monorail, 0); + Insert(airplane, 0); return true; } - public boolean Insert(T monorail, int position){ + public boolean Insert(T airplane, int position){ if (!(position >= 0 && position <= _places.size() && _places.size() < _maxCount)) return false; - _places.add(position, monorail); + _places.add(position, airplane); Count++; return true; } @@ -32,7 +32,7 @@ public class SetGeneric { return true; } public T Get(int position){ - if(!(position >= 0 && position < Count)) + if(!(position >= 0 && position < _places.size())) return null; return (T)_places.get(position); } diff --git a/src/Main.java b/src/Main.java index aaa6d6c..e996dc7 100644 --- a/src/Main.java +++ b/src/Main.java @@ -14,6 +14,6 @@ import javax.swing.*; public class Main { public static void main(String[] args) throws IOException { - FormForHard form = new FormForHard(); + FormAirplaneCollection form = new FormAirplaneCollection(); } } \ No newline at end of file