diff --git a/ProjectLiner/src/DrawningLiner.java b/ProjectLiner/src/DrawningLiner.java index f434b6a..885ddcc 100644 --- a/ProjectLiner/src/DrawningLiner.java +++ b/ProjectLiner/src/DrawningLiner.java @@ -9,8 +9,8 @@ public class DrawningLiner extends JPanel { private Integer picture_height; private Integer _StartPosX; private Integer _StartPosY; - private int drawningCarWidth = 120; - private int drawningCarHeight = 90; + private int drawningLinerWidth = 160; + private int drawningLinerHeight = 120; public void Init(int speed, double weight, Color bodycolor, Color additionalcolor, boolean pipe, boolean anchor) { EntityLiner = new EntityLiner(); @@ -26,17 +26,17 @@ public class DrawningLiner extends JPanel { } public boolean SetPictureSize(int width, int height) { - if (width < drawningCarWidth || height < drawningCarHeight) + if (width < drawningLinerWidth || height < drawningLinerHeight) return false; picture_width = width; picture_height = height; if (_StartPosX != null || _StartPosY != null) { - if (_StartPosX + drawningCarWidth > picture_width) { - _StartPosX = _StartPosX - (_StartPosX + drawningCarWidth - picture_width); + if (_StartPosX + drawningLinerWidth > picture_width) { + _StartPosX = _StartPosX - (_StartPosX + drawningLinerWidth - picture_width); } else if (_StartPosX < 0) _StartPosX = 0; - if (_StartPosY + drawningCarHeight > picture_height) { - _StartPosY = _StartPosY - (_StartPosY + drawningCarHeight - picture_height); + if (_StartPosY + drawningLinerHeight > picture_height) { + _StartPosY = _StartPosY - (_StartPosY + drawningLinerHeight - picture_height); } else if (_StartPosY < 0) _StartPosY = 0; } @@ -46,14 +46,14 @@ public class DrawningLiner extends JPanel { public void SetPosition(int x, int y) { if (!(picture_width != null && picture_height != null)) return; - if (x + drawningCarWidth > picture_width) { - _StartPosX = x - (x + drawningCarWidth - picture_width); + if (x + drawningLinerWidth > picture_width) { + _StartPosX = x - (x + drawningLinerWidth - picture_width); } else if (x < 0) _StartPosX = 0; else _StartPosX = x; - if (y + drawningCarHeight > picture_height) { - _StartPosY = y - (y + drawningCarHeight - picture_height); + if (y + drawningLinerHeight > picture_height) { + _StartPosY = y - (y + drawningLinerHeight - picture_height); } else if (y < 0) _StartPosY = 0; else @@ -65,23 +65,23 @@ public class DrawningLiner extends JPanel { return false; switch (direction) { case Left: - if (_StartPosX - EntityLiner.Step > 0) { + if (_StartPosX - EntityLiner.Step > -40) { _StartPosX -= (int) EntityLiner.Step; } return true; case Up: - if (_StartPosY - EntityLiner.Step > 0) { + if (_StartPosY - EntityLiner.Step > -40) { _StartPosY -= (int) EntityLiner.Step; } return true; case Right: - if (_StartPosX + drawningCarWidth + 2 * (int) EntityLiner.Step < picture_width + if (_StartPosX + drawningLinerWidth + (int) EntityLiner.Step < picture_width - EntityLiner.Step) { _StartPosX += (int) EntityLiner.Step; } return true; case Down: - if (_StartPosY + drawningCarHeight + 2 * (int) EntityLiner.Step < picture_height + if (_StartPosY + drawningLinerHeight + (int) EntityLiner.Step < picture_height - EntityLiner.Step) { _StartPosY += (int) EntityLiner.Step; } diff --git a/ProjectLiner/src/FormLiner.java b/ProjectLiner/src/FormLiner.java index 116e619..88a9b70 100644 --- a/ProjectLiner/src/FormLiner.java +++ b/ProjectLiner/src/FormLiner.java @@ -30,17 +30,21 @@ public class FormLiner extends JFrame { Height = getHeight() - 35; CreateButton.setName("CREATE"); - Icon iconUp = new ImageIcon("src\\imges\\up.jpg"); + Icon iconUp = new ImageIcon( + "E:\\Проекты\\ООП Java\\Pibd_13_Fathutdinov.A.I_Hard\\ProjectLiner\\src\\images\\top.png"); UpButton.setIcon(iconUp); UpButton.setName("UP"); DownButton.setName("DOWN"); - Icon iconDown = new ImageIcon("src\\images\\down.jpg"); + Icon iconDown = new ImageIcon( + "E:\\Проекты\\ООП Java\\Pibd_13_Fathutdinov.A.I_Hard\\ProjectLiner\\src\\images\\bottom.png"); DownButton.setIcon(iconDown); LeftButton.setName("LEFT"); - Icon iconLeft = new ImageIcon("src\\images\\left.jpg"); + Icon iconLeft = new ImageIcon( + "E:\\Проекты\\ООП Java\\Pibd_13_Fathutdinov.A.I_Hard\\ProjectLiner\\src\\images\\left.png"); LeftButton.setIcon(iconLeft); RightButton.setName("RIGHT"); - Icon iconRight = new ImageIcon("src\\images\\right.jpg"); + Icon iconRight = new ImageIcon( + "E:\\Проекты\\ООП Java\\Pibd_13_Fathutdinov.A.I_Hard\\ProjectLiner\\src\\images\\right.png"); RightButton.setIcon(iconRight); CreateButton.addActionListener(new ActionListener() { diff --git a/ProjectLiner/src/images/bottom.png b/ProjectLiner/src/images/bottom.png new file mode 100644 index 0000000..504bf06 Binary files /dev/null and b/ProjectLiner/src/images/bottom.png differ diff --git a/ProjectLiner/src/images/down.jpg b/ProjectLiner/src/images/down.jpg deleted file mode 100644 index fc21b6a..0000000 Binary files a/ProjectLiner/src/images/down.jpg and /dev/null differ diff --git a/ProjectLiner/src/images/left.jpg b/ProjectLiner/src/images/left.jpg deleted file mode 100644 index 453db80..0000000 Binary files a/ProjectLiner/src/images/left.jpg and /dev/null differ diff --git a/ProjectLiner/src/images/left.png b/ProjectLiner/src/images/left.png new file mode 100644 index 0000000..2ac2a79 Binary files /dev/null and b/ProjectLiner/src/images/left.png differ diff --git a/ProjectLiner/src/images/right.jpg b/ProjectLiner/src/images/right.jpg deleted file mode 100644 index 1f9989a..0000000 Binary files a/ProjectLiner/src/images/right.jpg and /dev/null differ diff --git a/ProjectLiner/src/images/right.png b/ProjectLiner/src/images/right.png new file mode 100644 index 0000000..f97b115 Binary files /dev/null and b/ProjectLiner/src/images/right.png differ diff --git a/ProjectLiner/src/images/top.png b/ProjectLiner/src/images/top.png new file mode 100644 index 0000000..cec057e Binary files /dev/null and b/ProjectLiner/src/images/top.png differ diff --git a/ProjectLiner/src/images/up.jpg b/ProjectLiner/src/images/up.jpg deleted file mode 100644 index bfdaef6..0000000 Binary files a/ProjectLiner/src/images/up.jpg and /dev/null differ