закончил 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
protected void SetObjectsPosition() {
if (locCoord == null || _collection == null) return;
int row = 1, col = 1;
for (int i = 0; i < _collection.getCount(); i++, col++)
{
if(_collection.get(i) == null) continue;
int row = countInRow, col = 1;
for (int i = 0; i < _collection.getCount(); i++, col++) {
if (_collection.get(i) == null) continue;
_collection.get(i).SetPictureSize(_pictureWidth, _pictureHeight);
_collection.get(i).SetPosition(locCoord.get(row * countInRow - col).getKey() + 5, locCoord.get(row * countInRow - col).getValue() + 5);
if (col == countInRow)
{
_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) {
col = 0;
row++;
row--;
}
}
}
}

View File

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

View File

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