lab5 preparations for pull request p.2

This commit is contained in:
Zakharov_Rostislav 2023-12-09 09:55:52 +04:00
parent 3e82235fc8
commit 7fb34d7482
4 changed files with 6 additions and 6 deletions

View File

@ -25,11 +25,11 @@ public class DrawingShip {
return startPosY;
}
private int shipWidth = 150;
public int getShipWidth() {
public int getWidth() {
return shipWidth;
}
private int shipHeight = 50;
public int getShipHeight() {
public int getHeight() {
return shipHeight;
}
public IMoveableObject getMoveableObject() {return new DrawingObjectShip(this);}

View File

@ -244,8 +244,8 @@ public class FrameShipConfig extends JFrame {
drawingShip.setBlocksNumber(blocksNumber);
}
}
drawingShip.setPosition(pictureBoxWidth / 2 - drawingShip.getShipWidth() / 2,
pictureBoxHeight / 2 - drawingShip.getShipHeight() / 2);
drawingShip.setPosition(pictureBoxWidth / 2 - drawingShip.getWidth() / 2,
pictureBoxHeight / 2 - drawingShip.getHeight() / 2);
pictureBox.repaint();
return true;
} catch (UnsupportedFlavorException | IOException e) {

View File

@ -37,7 +37,7 @@ public class HardFrame extends JFrame {
}while(check);
buttonMakeObject.addActionListener(e -> {
DrawingShip drawingShip = generic.makeObject();
drawingShip.setPosition(pictureBoxWidth / 2 - drawingShip.getShipWidth()/2, pictureBoxHeight / 2 - drawingShip.getShipHeight()/2);
drawingShip.setPosition(pictureBoxWidth / 2 - drawingShip.getWidth()/2, pictureBoxHeight / 2 - drawingShip.getHeight()/2);
drawing = drawingShip;
draw();
});

View File

@ -13,7 +13,7 @@ public class DrawingObjectShip implements IMoveableObject{
if(drawingShip == null || drawingShip.getEntityShip() == null)
return null;
return new ObjectParameters(drawingShip.getPosX(), drawingShip.getPosY(),
drawingShip.getShipWidth(), drawingShip.getShipHeight());
drawingShip.getWidth(), drawingShip.getHeight());
}
@Override
public int getStep(){