From 63cdf0a8a799eea750de2171e536ea8379a756cd Mon Sep 17 00:00:00 2001 From: Alexander Hartung Date: Sun, 30 Jan 2022 16:53:19 +0100 Subject: [PATCH] remove offset for AblageStack --- src/main/java/solitaer/AblageStack.java | 2 +- src/main/java/solitaer/BaseStack.java | 12 +++++++++--- src/main/java/solitaer/SaveStack.java | 2 +- src/main/java/solitaer/StartStack.java | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/main/java/solitaer/AblageStack.java b/src/main/java/solitaer/AblageStack.java index 56439a0..c96818b 100644 --- a/src/main/java/solitaer/AblageStack.java +++ b/src/main/java/solitaer/AblageStack.java @@ -10,7 +10,7 @@ public class AblageStack extends BaseStack { private Symbol sym; public AblageStack(int _x, int _y, Symbol _sym) { - super(); + super(false); super.setLocation(_x, _y); super.setSize(IMAGE_WIDTH, STACK_HIGHT); super.setOpaque(false); diff --git a/src/main/java/solitaer/BaseStack.java b/src/main/java/solitaer/BaseStack.java index 84dfab2..a94321d 100644 --- a/src/main/java/solitaer/BaseStack.java +++ b/src/main/java/solitaer/BaseStack.java @@ -13,9 +13,15 @@ public abstract class BaseStack extends JPanel { private ArrayList stack = new ArrayList(); private final int OFFSET_VALUE = 20; int offset; + int addOffset; - public BaseStack() { + public BaseStack(boolean _offset) { // TODO Auto-generated constructor stub + if(_offset) { + addOffset = OFFSET_VALUE; + }else { + addOffset = 0; + } offset = 0; } @@ -43,13 +49,13 @@ public abstract class BaseStack extends JPanel { _card.setLocation(0, offset); stack.add(_card); RenderStackNew(); - offset += OFFSET_VALUE; + offset += addOffset; } public Card removeLastCard() { if (stack.size() != 0) { Card LastCard = stack.remove(stack.size() - 1); - offset -= OFFSET_VALUE; + offset -= addOffset; RenderStackNew(); return LastCard; } diff --git a/src/main/java/solitaer/SaveStack.java b/src/main/java/solitaer/SaveStack.java index 3f423a2..cd4cea0 100644 --- a/src/main/java/solitaer/SaveStack.java +++ b/src/main/java/solitaer/SaveStack.java @@ -9,7 +9,7 @@ public class SaveStack extends BaseStack { public SaveStack(int _x, int _y) { // TODO Auto-generated constructor stub - super(); + super(true); super.setLocation(_x, _y); super.setSize(IMAGE_WIDTH, STACK_HIGHT); super.setOpaque(false); diff --git a/src/main/java/solitaer/StartStack.java b/src/main/java/solitaer/StartStack.java index 8f14ae6..068b88f 100644 --- a/src/main/java/solitaer/StartStack.java +++ b/src/main/java/solitaer/StartStack.java @@ -9,7 +9,7 @@ public class StartStack extends BaseStack { private static final long serialVersionUID = 1L; public StartStack(int _x, int _y) { - super(); + super(true); super.setLocation(_x, _y); super.setSize(IMAGE_WIDTH, STACK_HIGHT); super.setOpaque(false);