it is to be...

This commit is contained in:
antoc0der 2023-11-27 10:54:49 +03:00
parent 1252238fc4
commit 968cc81bc8
4 changed files with 16 additions and 16 deletions

View File

@ -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<DrawningAirplane, DrawningObjectAirplane> _airplanes = _storage.Get(listBoxStorages.getSelectedValue());
AirplaneGenericCollection<DrawningAirplane, DrawningObjectAirplane> _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<DrawningAirplane, DrawningObjectAirplane> _airplanes = _storage.Get(listBoxStorages.getSelectedValue());
AirplaneGenericCollection<DrawningAirplane, DrawningObjectAirplane> _airplanes = _storage.Get(listBoxStorages.getSelectedValue());
if(_airplanes == null) {
return;
}

View File

@ -11,18 +11,19 @@ public class AirplaneTrashCollection <T extends DrawningAirplane>{
_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(){

View File

@ -10,17 +10,17 @@ public class SetGeneric <T extends Object>{
_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 <T extends Object>{
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);
}

View File

@ -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();
}
}