PIbd-23. Zakharov R.A. Lab work 05 #6
@ -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);}
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
});
|
||||
|
@ -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(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user