From ebf388da3d3eab4d9ef96319c67ee2b963956035 Mon Sep 17 00:00:00 2001 From: russell Date: Fri, 24 Nov 2023 21:39:08 +0400 Subject: [PATCH] =?UTF-8?q?=D0=93=D0=BE=D1=82=D0=BE=D0=B2=D0=B0=D1=8F=201?= =?UTF-8?q?=20=D0=BB=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82=D0=BE=D1=80=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/PIbd-21_Anisin_R.S._DumpTruck._Hard.iml | 1 + Resources/down.png | Bin 0 -> 1638 bytes Resources/left.png | Bin 0 -> 1668 bytes Resources/right.png | Bin 0 -> 1673 bytes Resources/up.png | Bin 0 -> 1636 bytes src/DumpTruck/DirectionType.java | 11 ++ src/DumpTruck/DrawingDumpTruck.java | 110 ++++++++++++++++ src/DumpTruck/DrawingWheels.java | 55 ++++++++ src/DumpTruck/EntityDumpTruck.java | 61 +++++++++ src/DumpTruck/FrameDumpTruck.java | 17 +++ src/{ => DumpTruck}/Main.java | 6 +- src/DumpTruck/PictureBoxDumpTruck.java | 122 ++++++++++++++++++ src/DumpTruck/WheelNumber.java | 9 ++ 13 files changed, 390 insertions(+), 2 deletions(-) create mode 100644 Resources/down.png create mode 100644 Resources/left.png create mode 100644 Resources/right.png create mode 100644 Resources/up.png create mode 100644 src/DumpTruck/DirectionType.java create mode 100644 src/DumpTruck/DrawingDumpTruck.java create mode 100644 src/DumpTruck/DrawingWheels.java create mode 100644 src/DumpTruck/EntityDumpTruck.java create mode 100644 src/DumpTruck/FrameDumpTruck.java rename src/{ => DumpTruck}/Main.java (59%) create mode 100644 src/DumpTruck/PictureBoxDumpTruck.java create mode 100644 src/DumpTruck/WheelNumber.java diff --git a/.idea/PIbd-21_Anisin_R.S._DumpTruck._Hard.iml b/.idea/PIbd-21_Anisin_R.S._DumpTruck._Hard.iml index c90834f..d5b343a 100644 --- a/.idea/PIbd-21_Anisin_R.S._DumpTruck._Hard.iml +++ b/.idea/PIbd-21_Anisin_R.S._DumpTruck._Hard.iml @@ -3,6 +3,7 @@ + diff --git a/Resources/down.png b/Resources/down.png new file mode 100644 index 0000000000000000000000000000000000000000..8efa2de8de06fecf890f4397d847d90d0ec3129b GIT binary patch literal 1638 zcmbVNe{2&~94`VgAR~rUW=w?RCdrIm@7}e&wvTnN_A0H}&C=B}Vsu>ZUfbK+d*|JC z?S>jLkbsdtNQ@+sX~abQL-LiCpsT zy?gKT{d|AC@ArELlKtD-S3SAP<#M$r;$n)->z&c|D0y$@P8=oEN+Z70a=AJ}&RFvL z-nki@>EL(LAzYtTdIbvj3ArJqP(Vu>FZ}EX-ZSW^bWto zNk$YEwD`D*2FCl-%J_&9Qt2%{RCg5;f)cW2s#+@Q7OaNp8ZRVkXPc#|8pIw6)4h&D zYEVj2QEVd0?-3XU_<~d*pf?}h@%udG}14d0G+t^HF zTx?!cvS~8K6R)YR9h$D9+agpV78O895E$MAYUWB3Oz4&^>k3MUVVVTTqiHHs0YCy53Nor+1`MbA z0!$G30mBD)AD2^AP7$(Ac@ZmRCk2}F>i?8~(bPx@%EgD~aSGGP9T?Xva;syF(iuRn zHC9E9s-+8*6{ifswBp=9Qt8IF_RtZi(^d+Ikp4$r)L|CR*%jGDy?GL?2j(41jAxyK zt^2|L)5Y4^qT+7CNyl)OtyV=oTFnmWq{Eq{m2Hmn9VcyYAtCmr;|H$2fA*d8TiyF6 z_fPjs&-U#3F)P|J_w3xPxgjauSu!2_eA&w*=T3c-S-Mf}fAg!2(we^V#qee0`eSRw z?c(FZ>B#YOFAe_!{`xx8w&xfh>{|BfRQJxSk8J<--OFt!bL`sX);w7FaMSLU#ux5a zepq^FxA)Tt?v2B5jf(SrEpy`#``LFHpJZ;G6z>jYZk~SnOZN6m$kRUc!rlw1J0IWp z==aFM1-kge&6E2so*w9^uKvS)>%v4%>pXw9_u!?OiOL6?Zq2QpoIeWNu1blnX z(^JFl4QEdMHfOI`kB%H!b7kntCq*lH_uKDx4c%Vx=g(8?jtTqUbN&R0Sig88vg_@? E0ggT*=>Px# literal 0 HcmV?d00001 diff --git a/Resources/left.png b/Resources/left.png new file mode 100644 index 0000000000000000000000000000000000000000..4aaee885a744ae03177b59eef4b9cc629c7fefa0 GIT binary patch literal 1668 zcmbVNe@q)y953RAFky=^V_PO(ZZW!z>-{R%_M{SM8Ev2pSry#kve&!U_Mms~c6ZPg z$mYoY5MvBm;u0q&1U5sW5Mx5JxGfC*Xa3{RxXn0Sz`rnCCPs|L4E0@G8fK=8yX5ZP zz4v*a@Avb4-|zQ^+FF~+%eIv{9FFo(Fwl2Oqf?Yn5; z__tp;9P2hKkxr{K+#*Uybpjbhp);-O80~P>)}?hIbwi7Y!nmUO$e+&7kc1-p$c~yY z6W0AOp#=L3xUa7@BK37kUYV?Wfv8Q3m_UUVAku15GsU!z%<_tOY){i9k%d^@KC<36 zNOXqV2tP6)QR5USiFJ7hx7W!EE`}GX365dCG~=OJo?=*$5yTodk-tc6&5&badtguA z7XI>)3Cq$&nogxs&J^!NMx187Ud+MK97kaUWo9%Bq$$nZvC0sDrer9(r67&489@~F zSUwVanvv)q!z5IpW|2_$M9z%kSz1Yniwi;dZ8xUB? zh#-_)J*c)-mkAE5CZ6k1G#RDLoohD00I;Bs}g7I+|7mc$q`RDcC5Du_c`*Wx5m2&3pnNn~Kd*gJmh ze8}%_Gf+%P;svw4seuSJ`UTc22o&dJv+jn&Vn{PBph++k@R2w;PDPPL;F3L@;FhQ; z;AM&dE*Ax25~Ms55Ii0}<`TG^T)aPkq#ip3R`<*QbN^mL!6gWi56xp2rky)tP%-hT zX7Z)84<62sk_wSc7ZFHy8Td%aK7S~a`Dx{$Baov_B_JmKkG#miOcb+Hz<~8}9IXfD z9gUr*?Sjqep#Lc`ySApdSK+v0*uz4r!XJfZ2Q}Q`4BX02Zdk$nwCKrDpgs~Dx_GU= ztAXA0+QQS7uPzINl@n(#kB^blqb2&S=`*jtL7eUSajL3maqPyqxsrtwTgN~5Fz*gu zpg(K=bbe&~^w7`i-ds60dSdIrqB|q>Z-bRp`(vQ|O7TQ-#idJSe{O0kd3fxzy2UtH&B1OthxoAAN6baQjlEzW=MSNaqL3;Tvk%?U~@!?TJKLwXfpE#mSF) z_nv1Lr}d|Pe`#({^{&|(aHn`_V&K+a+dO^lg9Bv8_bnV*asB1l1E-drxqJ1A_1}EA zKl9eJ=H&d9Q_RR|Z|TvGkJAfk^OpGovm2VXEca_SZ+4x_^zUBzrS4FowD|TTOP4?S pfjd(B^@kVVj&5wZdu;gdqch6pFMqxM$2<0aBGlL#m})pQ_&0>2GokX^c_d^a_p|M_J$B5kEn5lQ=2qNLV|KlJZIAWtop-mj zn~F#zih<}KYCO{6W z=P}Gxuf}@q-snz2h8iU)Fb=4!W*{_%H8y1pN$v+W9tTNP7m1%vPZGGQh(wP!%0!JI zNU3eZCg>h+kIBRRazG)Pw&9Ig0TF1xmhh~W)-53`5_w($t(|R}!1EBhUnH6xg?MkY z6AwZY;9iO+W!B@zeF2K)J&c>*f^!TTpcy~Sx=Dr=7+&!D@WMkNZKjeCx5>bYQKHqYLYPp%=&WSWEX6o3<$;P^!Wjc*Il57kJ&Z?Sm?dZwDr#bA zIg}+?PmE&)7J=AnpeSV&$(C*iR%9UoO-(`$tD2Mqw4o;nyc9+u2-DC+ijj5h<@=Ff zu+xMIHH{9euGSVj5)Sfgfagh$V)N!kqe4WtY)O|vBqS0jIFza?0-xXmKAD$E)-U-; zf4~zb{d__uJzlTd6KA|0x8f%*#ZU!A&|1ML?NJ=nMJgZ&rGX-ste_G_c-*4%6J3wnp^>D;dNb$!R?eH)H^&fME` zmi~C8d}TJ4gYyw?{TrKGj=nH1bgpSVROid}oZeMazU5E;!uz+?udSMVDcn7+x#o7P z>6(hV<`y^YmTKly*#G3#@z-5@@1F^-I(*>d$#;)Gy63<<*5=EXYIE!S!!vyyZ`DoS sk{TO%KzeWD()Q7DW~z4a+3@2z`s%s*Go#1kubrPoB-|c4(bBj7ZxG!sk^lez literal 0 HcmV?d00001 diff --git a/Resources/up.png b/Resources/up.png new file mode 100644 index 0000000000000000000000000000000000000000..81a790317b4c9254f10b60e72d7ed5c348a13170 GIT binary patch literal 1636 zcmbVNTWl0n7@oF4V3Q^gwFDB|ahf)TIy;x0o$U-PwVhqrtxnx6lTt+uvomM6LwDwk zGqdb&Q%q5$5))#Kmx=+2!2p`nR}82GFL+6eBB(Ky2Om%#Yz^@e;Q`O=EybWjCOLD? zob&zPe>wmE&)(GVrq;lk0ES_$$wVxT=5~K9yA8e9)3dLmX}O(v$i=W#fU~en8Zq8B}$c0l|`KBQ%C>=r7r-HV!;I19FBHB^FM+PvC|gCANfRTDB!H zW+WyYuz6xw(I&<I2wrWKxTIO-q@n#0M&zz0%5*> zQK`DgIE%c-d$t&s4vX&EMFJqEdLT-$G#errnhY@tON&fI4Dr1*C(?8kDns4KmKQ@A zlHnAV5gATo`>uncl+jgBy(w7N#4L176*+8}Y7S7gl_T&*7)1%@p@S47>q3k7laiEj zVAjZ^12?^C5KqP>o)LJSWP?n_Tv-;Amg}jO29mKTfr1k>3>_t6Cc`s8BeUTQPi6t9 zl0t-|Ng*3i^^hKkuo12 zYpcA0SJFjPHNOm^gy!Er(23f%amx{?(iX=6BK?oNsKQ*B^@^$k268A`H_bZ=8Bh5I zTlItbr;C-dMa5l*qmJP(8?6d`G@2c-P=|9+E1Q>2UO{c}w`6QUN$maQB{^`KzGL^1 z_A>|Y<0C6q#y{%+vgP>i4--FjJaevN?$S4}E_)2OCRa$86XsdM+ct97#m_r;zOidX zv(fW%Al!28*#I_VOhK$YDXqdjJTraxQ19}gjeqT#=TZy5cC~bMJSzRvmb!f5&U4xH zdG(Q>_phazKe;*uXU^_>;Vt@|`<0_7kGwg(fAYYmTNlbo&#~1@XRr1>x3q2gVt3?% z@F!6q4;^0jwL9{`*6z7|Sl5fMyx05mU^jQAX=pq1ZV{WAn0kKAp83^Fwtx22!Iq=P zPQ1PThucqmcegVCMAOVn^W4FY&wqRGz#r0UyLMh`{c7RVy6Mx`y8Qn@GCmxe9o+Wh E-^;Te4*&oF literal 0 HcmV?d00001 diff --git a/src/DumpTruck/DirectionType.java b/src/DumpTruck/DirectionType.java new file mode 100644 index 0000000..0d52a30 --- /dev/null +++ b/src/DumpTruck/DirectionType.java @@ -0,0 +1,11 @@ +package DumpTruck; + +public enum DirectionType { + Up, + + Down, + + Left, + + Right +} \ No newline at end of file diff --git a/src/DumpTruck/DrawingDumpTruck.java b/src/DumpTruck/DrawingDumpTruck.java new file mode 100644 index 0000000..ec14ba9 --- /dev/null +++ b/src/DumpTruck/DrawingDumpTruck.java @@ -0,0 +1,110 @@ +package DumpTruck; + +import java.awt.*; + +public class DrawingDumpTruck { + + private EntityDumpTruck entityDumpTruck; + + public EntityDumpTruck getEntityDumpTruck() { + return entityDumpTruck; + } + + private DrawingWheels drawingWheels; + + private int _pictureWidth; + private int _pictureHeight; + private int _startPosX; + private int _startPosY; + private int _truckWidth = 160; + private int _truckHeight = 90; + + public boolean Init(int speed, double weight, Color bodyColor, boolean tent, boolean dumpBox, Color tentColor, Color dumpBoxColor, int width, int height, int wheelNumber) + { + if (height < _truckHeight || width < _truckWidth) { + return false; + } + _pictureWidth = width; + _pictureHeight = height; + entityDumpTruck = new EntityDumpTruck(); + entityDumpTruck.Init(speed, weight, bodyColor, tent, dumpBox, tentColor, dumpBoxColor); + drawingWheels = new DrawingWheels(); + drawingWheels.setWheelNumber(wheelNumber); + return true; + } + + public void SetPosition(int x, int y) + { + if (x < 0 || x + _truckWidth > _pictureWidth) { x = 0; } + if (y < 0 || y + _truckHeight > _pictureHeight) { y = 0; } + _startPosX = x; + _startPosY = y; + } + + public void MoveTransport(DirectionType direction) { + if (entityDumpTruck == null) return; + + switch (direction) { + //влево + case Left: + if (_startPosX - entityDumpTruck.getStep() > 0) + { + _startPosX -= (int)entityDumpTruck.getStep(); + } + break; + //вверх + case Up: + if (_startPosY - entityDumpTruck.getStep() > 0) + { + _startPosY -= (int)entityDumpTruck.getStep(); + } + break; + //вправо + case Right: + if (_startPosX + _truckWidth + entityDumpTruck.getStep() < _pictureWidth) + { + _startPosX += (int)entityDumpTruck.getStep(); + } + break; + //вниз + case Down: + if (_startPosY + _truckHeight + entityDumpTruck.getStep() < _pictureHeight) + { + _startPosY += (int)entityDumpTruck.getStep(); + } + break; + } + } + + public void DrawTransport(Graphics2D g2D) + { + if (entityDumpTruck == null) { + return; + } + g2D.setStroke(new BasicStroke(3)); + g2D.setPaint(entityDumpTruck.getBodyColor()); + g2D.fillRect(_startPosX, _startPosY + 40, 160, 10); + g2D.fillRect(_startPosX + 120, _startPosY, 40, 40); + drawingWheels.drawWheels(g2D, Color.BLACK, _startPosX, _startPosY); + if (entityDumpTruck.getDumpBox()) + { + g2D.setPaint(entityDumpTruck.getDumpBoxColor()); + Polygon dumpBoxPolygon = new Polygon(); + dumpBoxPolygon.addPoint(_startPosX + 20, _startPosY); + dumpBoxPolygon.addPoint(_startPosX + 120, _startPosY); + dumpBoxPolygon.addPoint(_startPosX + 100, _startPosY + 39); + dumpBoxPolygon.addPoint(_startPosX, _startPosY + 39); + g2D.fillPolygon(dumpBoxPolygon); + } + if (entityDumpTruck.getDumpBox() && entityDumpTruck.getTent()) + { + g2D.setPaint(entityDumpTruck.getTentColor()); + Polygon tentPolygon = new Polygon(); + tentPolygon.addPoint(_startPosX + 15, _startPosY); + tentPolygon.addPoint(_startPosX + 120, _startPosY); + tentPolygon.addPoint(_startPosX + 115, _startPosY + 10); + tentPolygon.addPoint(_startPosX + 10, _startPosY + 10); + g2D.fillPolygon(tentPolygon); + } + } +} diff --git a/src/DumpTruck/DrawingWheels.java b/src/DumpTruck/DrawingWheels.java new file mode 100644 index 0000000..fe1d640 --- /dev/null +++ b/src/DumpTruck/DrawingWheels.java @@ -0,0 +1,55 @@ +package DumpTruck; + +import java.awt.*; + +public class DrawingWheels { + + private WheelNumber wheelNumber; + + public void setWheelNumber(int number) { + switch (number) { + case 2: + wheelNumber = wheelNumber.Two; + break; + case 3: + wheelNumber = wheelNumber.Three; + break; + case 4: + wheelNumber = wheelNumber.Four; + break; + default: wheelNumber = wheelNumber.Two; + } + } + + public void drawWheels(Graphics2D g2D, Color color, int _startPosX, int _startPosY) { + switch (wheelNumber) { + case Two: + drawTwoWheels(g2D, color, _startPosX, _startPosY); + break; + case Three: + drawThreeWheels(g2D, color, _startPosX, _startPosY); + break; + case Four: + drawFourWheels(g2D, color, _startPosX, _startPosY); + break; + } + } + + private void drawTwoWheels(Graphics2D g2D, Color color, int _startPosX, int _startPosY) { + g2D.setColor(color); + g2D.fillOval(_startPosX, _startPosY + 50, 40, 40); + g2D.fillOval(_startPosX + 120, _startPosY + 50, 40, 40); + } + + private void drawThreeWheels(Graphics2D g2D, Color color, int _startPosX, int _startPosY) { + g2D.setColor(color); + drawTwoWheels(g2D, color, _startPosX, _startPosY); + g2D.fillOval(_startPosX + 40, _startPosY + 50, 40, 40); + } + + private void drawFourWheels(Graphics2D g2D, Color color, int _startPosX, int _startPosY) { + g2D.setColor(color); + drawThreeWheels(g2D, color, _startPosX, _startPosY); + g2D.fillOval(_startPosX + 80, _startPosY + 50, 40, 40); + } +} \ No newline at end of file diff --git a/src/DumpTruck/EntityDumpTruck.java b/src/DumpTruck/EntityDumpTruck.java new file mode 100644 index 0000000..cefd08a --- /dev/null +++ b/src/DumpTruck/EntityDumpTruck.java @@ -0,0 +1,61 @@ +package DumpTruck; + +import java.awt.*; +public class EntityDumpTruck { + + private int Speed; + + public int getSpeed() { + return Speed; + } + + private double Weight; + + public double getWeight() { + return Weight; + } + + private Color BodyColor; + + public Color getBodyColor() { + return BodyColor; + } + + private boolean Tent; + + public boolean getTent() { + return Tent; + } + + private boolean DumpBox; + + public boolean getDumpBox() { + return DumpBox; + } + + private Color DumpBoxColor; + + public Color getDumpBoxColor() { + return DumpBoxColor; + } + + private Color TentColor; + + public Color getTentColor() { + return TentColor; + } + + public double getStep() { + return (double)Speed * 100 / Weight; + } + + public void Init(int speed, double weight, Color bodyColor, boolean tent, boolean dumpBox, Color tentColor, Color dumpBoxColor) { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + Tent = tent; + DumpBox = dumpBox; + DumpBoxColor = dumpBoxColor; + TentColor = tentColor; + } +} diff --git a/src/DumpTruck/FrameDumpTruck.java b/src/DumpTruck/FrameDumpTruck.java new file mode 100644 index 0000000..e7f69d6 --- /dev/null +++ b/src/DumpTruck/FrameDumpTruck.java @@ -0,0 +1,17 @@ +package DumpTruck; + +import javax.swing.*; + +public class FrameDumpTruck extends JFrame { + + private PictureBoxDumpTruck pictureBoxDumpTruck; + + public FrameDumpTruck() { + setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + pictureBoxDumpTruck = new PictureBoxDumpTruck(); + add(pictureBoxDumpTruck); + pack(); + setLocationRelativeTo(null); + setVisible(true); + } +} \ No newline at end of file diff --git a/src/Main.java b/src/DumpTruck/Main.java similarity index 59% rename from src/Main.java rename to src/DumpTruck/Main.java index 6054a64..be46a71 100644 --- a/src/Main.java +++ b/src/DumpTruck/Main.java @@ -1,5 +1,7 @@ +package DumpTruck; + public class Main { public static void main(String[] args) { - + new FrameDumpTruck(); } -} +} \ No newline at end of file diff --git a/src/DumpTruck/PictureBoxDumpTruck.java b/src/DumpTruck/PictureBoxDumpTruck.java new file mode 100644 index 0000000..d0d100b --- /dev/null +++ b/src/DumpTruck/PictureBoxDumpTruck.java @@ -0,0 +1,122 @@ +package DumpTruck; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionListener; +import java.util.Random; + +public class PictureBoxDumpTruck extends JPanel { + private DrawingDumpTruck drawingDumpTruck; + + private JButton buttonLeft; + + private JButton buttonUp; + + private JButton buttonRight; + + private JButton buttonDown; + + private JButton buttonCreateDumpTruck; + + public PictureBoxDumpTruck() { + setLayout(null); + setBounds(0, 0, 800, 450); + buttonCreateDumpTruck = new JButton("Создать"); + buttonCreateDumpTruck.setFocusable(false); + buttonCreateDumpTruck.setBounds(12, 415, 100, 30); + add(buttonCreateDumpTruck); + + buttonCreateDumpTruck.addActionListener(e -> { + Random random = new Random(); + drawingDumpTruck = new DrawingDumpTruck(); + drawingDumpTruck.Init(random.nextInt(200, 300), + random.nextInt(1000, 3000), + new Color(random.nextInt(0, 256), random.nextInt(0, 256), + random.nextInt(0, 256)), + random.nextBoolean(), random.nextBoolean(), + new Color(random.nextInt(0, 256), random.nextInt(0, 256), + random.nextInt(0, 256)), + new Color(random.nextInt(0, 256), random.nextInt(0, 256), + random.nextInt(0, 256)), + this.getWidth(), this.getHeight(), random.nextInt(2, 5)); + drawingDumpTruck.SetPosition(random.nextInt(10, 100), random.nextInt(10, 100)); + repaint(); + }); + + ActionListener buttonMoveListener = e -> { + if (drawingDumpTruck == null) + { + return; + } + + String buttonName = ((JButton) e.getSource()).getName(); + + switch (buttonName) { + case ("buttonUp"): + drawingDumpTruck.MoveTransport(DirectionType.Up); + break; + case ("buttonDown"): + drawingDumpTruck.MoveTransport(DirectionType.Down); + break; + case ("buttonLeft"): + drawingDumpTruck.MoveTransport(DirectionType.Left); + break; + case ("buttonRight"): + drawingDumpTruck.MoveTransport(DirectionType.Right); + break; + } + repaint(); + }; + buttonLeft = new JButton(); + buttonLeft.setName("buttonLeft"); + buttonLeft.setFocusable(false); + buttonLeft.setPreferredSize(new Dimension(30, 30)); + buttonLeft.setIcon(new ImageIcon("Resources/left.png")); + buttonLeft.addActionListener(buttonMoveListener); + buttonLeft.setBounds(686, 408, 30, 30); + + add(buttonLeft); + + buttonRight = new JButton(); + buttonRight.setName("buttonRight"); + buttonRight.setFocusable(false); + buttonRight.setPreferredSize(new Dimension(30, 30)); + buttonRight.setIcon(new ImageIcon("Resources/right.png")); + buttonRight.addActionListener(buttonMoveListener); + buttonRight.setBounds(758, 408, 30, 30); + + add(buttonRight); + + buttonDown = new JButton(); + buttonDown.setName("buttonDown"); + buttonDown.setFocusable(false); + buttonDown.setPreferredSize(new Dimension(30, 30)); + buttonDown.setIcon(new ImageIcon("Resources/down.png")); + buttonDown.addActionListener(buttonMoveListener); + buttonDown.setBounds(722, 408, 30, 30); + + add(buttonDown); + + buttonUp = new JButton(); + buttonUp.setName("buttonUp"); + buttonUp.setFocusable(false); + buttonUp.setPreferredSize(new Dimension(30, 30)); + buttonUp.setIcon(new ImageIcon("Resources/up.png")); + buttonUp.addActionListener(buttonMoveListener); + buttonUp.setBounds(722, 372, 30, 30); + + add(buttonUp); + setPreferredSize(new Dimension(800, 450)); + + } + + @Override + protected void paintComponent(Graphics g) { + if (drawingDumpTruck == null) { + return; + } + super.paintComponent(g); + Graphics2D g2d = (Graphics2D) g; + drawingDumpTruck.DrawTransport(g2d); + } +} diff --git a/src/DumpTruck/WheelNumber.java b/src/DumpTruck/WheelNumber.java new file mode 100644 index 0000000..c3363a1 --- /dev/null +++ b/src/DumpTruck/WheelNumber.java @@ -0,0 +1,9 @@ +package DumpTruck; + +public enum WheelNumber { + Two, + + Three, + + Four +} \ No newline at end of file