закончил labwork03

This commit is contained in:
BoiledMilk123 2024-06-05 08:59:00 +04:00
parent a180fa3b0a
commit 397c8a2377
3 changed files with 11 additions and 12 deletions

View File

@ -41,17 +41,16 @@ public class LocomotiveDepotService extends AbstractCompany
@Override @Override
protected void SetObjectsPosition() { protected void SetObjectsPosition() {
if (locCoord == null || _collection == null) return; if (locCoord == null || _collection == null) return;
int row = 1, col = 1; int row = countInRow, col = 1;
for (int i = 0; i < _collection.getCount(); i++, col++) for (int i = 0; i < _collection.getCount(); i++, col++) {
{ if (_collection.get(i) == null) continue;
if(_collection.get(i) == null) continue;
_collection.get(i).SetPictureSize(_pictureWidth, _pictureHeight); _collection.get(i).SetPictureSize(_pictureWidth, _pictureHeight);
_collection.get(i).SetPosition(locCoord.get(row * countInRow - col).getKey() + 5, locCoord.get(row * countInRow - col).getValue() + 5); _collection.get(i).SetPosition(locCoord.get((row - 1) * countInRow + (col - 1)).getKey() + 5, locCoord.get((row - 1) * countInRow + (col - 1)).getValue() + 5);
if (col == countInRow) if (col == countInRow) {
{
col = 0; col = 0;
row++; row--;
} }
} }
} }
} }

View File

@ -24,7 +24,7 @@ public class SpecialGenerateLocomotive <T extends EntityLocomotive, U extends ID
public String getEn(int ind) { public String getEn(int ind) {
if(entityArray.get(ind) instanceof EntityElectricLocomotive) { if(entityArray.get(ind) instanceof EntityElectricLocomotive) {
EntityElectricLocomotive entity = (EntityElectricLocomotive)entityArray.get(ind); EntityElectricLocomotive entity = (EntityElectricLocomotive)entityArray.get(ind);
return "EntityWarmlyShip{" + return "EntityElectricLocomotive{" +
"speed=" + entity.GetSpeed() + "speed=" + entity.GetSpeed() +
", weight=" + entity.GetWeight() + ", weight=" + entity.GetWeight() +
", bodyColor=" + entity.GetBodyColor() + ", bodyColor=" + entity.GetBodyColor() +
@ -35,7 +35,7 @@ public class SpecialGenerateLocomotive <T extends EntityLocomotive, U extends ID
'}'; '}';
} }
else{ else{
return "EntityShip{" + return "EntityLocomotive{" +
"speed=" + entityArray.get(ind).GetSpeed() + "speed=" + entityArray.get(ind).GetSpeed() +
", weight=" + entityArray.get(ind).GetWeight() + ", weight=" + entityArray.get(ind).GetWeight() +
", bodyColor=" + entityArray.get(ind).GetBodyColor() + ", bodyColor=" + entityArray.get(ind).GetBodyColor() +

View File

@ -47,8 +47,8 @@ public class FormGenerateLocomotive extends JFrame
sendObject = new JButton("Отправить"); sendObject = new JButton("Отправить");
panelLocomotive.setBorder(BorderFactory.createTitledBorder("Объект")); panelLocomotive.setBorder(BorderFactory.createTitledBorder("Объект"));
panelInfoLocomotive.setBorder(BorderFactory.createTitledBorder("Информация о кораблях")); panelInfoLocomotive.setBorder(BorderFactory.createTitledBorder("Информация о локомотивах"));
panelInfoWheels.setBorder(BorderFactory.createTitledBorder("Информация о палубах")); panelInfoWheels.setBorder(BorderFactory.createTitledBorder("Информация о колёсах"));
panelButtonManage.setLayout(new GridLayout(1, 2)); panelButtonManage.setLayout(new GridLayout(1, 2));
labelInfoLocomotive.setVerticalAlignment(SwingConstants.TOP); labelInfoLocomotive.setVerticalAlignment(SwingConstants.TOP);