Browse Source

remove offset for AblageStack

feature_solitaer_AblageStack
Alexander Hartung 3 years ago
parent
commit
63cdf0a8a7
  1. 2
      src/main/java/solitaer/AblageStack.java
  2. 12
      src/main/java/solitaer/BaseStack.java
  3. 2
      src/main/java/solitaer/SaveStack.java
  4. 2
      src/main/java/solitaer/StartStack.java

2
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);

12
src/main/java/solitaer/BaseStack.java

@ -13,9 +13,15 @@ public abstract class BaseStack extends JPanel {
private ArrayList<Card> stack = new ArrayList<Card>();
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;
}

2
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);

2
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);

Loading…
Cancel
Save