|
@ -30,17 +30,22 @@ public class MyMouseListener implements MouseInputListener { |
|
|
System.out.println("DOWN"); |
|
|
System.out.println("DOWN"); |
|
|
Component com = SwingUtilities.getDeepestComponentAt(e.getComponent(), e.getX(), e.getY()); |
|
|
Component com = SwingUtilities.getDeepestComponentAt(e.getComponent(), e.getX(), e.getY()); |
|
|
|
|
|
|
|
|
// Leeres StartFeld |
|
|
|
|
|
if (com instanceof StartStack) { |
|
|
|
|
|
System.out.println("Leer Start"); |
|
|
|
|
|
|
|
|
// // Leeres StartFeld |
|
|
|
|
|
// if (com instanceof StartStack) { |
|
|
|
|
|
// System.out.println("Leer Start"); |
|
|
|
|
|
// |
|
|
|
|
|
// } |
|
|
|
|
|
// // Karte, die in einem StartStack liegt |
|
|
|
|
|
// else |
|
|
|
|
|
if ((com instanceof Card && com.getParent() instanceof StartStack) |
|
|
|
|
|
|| (com instanceof StartStack && ((StartStack) com).stackIsEmpty())) { |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
// Karte, die in einem StartStack liegt |
|
|
|
|
|
else if (com instanceof Card && com.getParent() instanceof StartStack) { |
|
|
|
|
|
|
|
|
if (saveStack.stackIsEmpty()) { |
|
|
|
|
|
|
|
|
|
|
|
if (com instanceof Card && com.getParent() instanceof StartStack) { |
|
|
tempCard = (Card) com; |
|
|
tempCard = (Card) com; |
|
|
tempStack = (StartStack) com.getParent(); |
|
|
tempStack = (StartStack) com.getParent(); |
|
|
|
|
|
|
|
|
if (saveStack.stackIsEmpty()) { |
|
|
|
|
|
// Wenn faceDown, schau ob es die oberste Carde ist und dreh diese um |
|
|
// Wenn faceDown, schau ob es die oberste Carde ist und dreh diese um |
|
|
if (!tempCard.isFaceUp()) { |
|
|
if (!tempCard.isFaceUp()) { |
|
|
if (tempStack.peekLastCard().equals(tempCard)) { |
|
|
if (tempStack.peekLastCard().equals(tempCard)) { |
|
@ -59,8 +64,15 @@ public class MyMouseListener implements MouseInputListener { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
// saveStack is NOT empty |
|
|
// saveStack is NOT empty |
|
|
else { |
|
|
else { |
|
|
|
|
|
if(com instanceof StartStack) { |
|
|
|
|
|
tempStack = (StartStack) com; |
|
|
|
|
|
} else { |
|
|
|
|
|
tempStack = (StartStack) com.getParent(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if (selectedStack == null) { |
|
|
if (selectedStack == null) { |
|
|
System.out.println("ERROR selectedStack in StartStack"); |
|
|
System.out.println("ERROR selectedStack in StartStack"); |
|
|
} |
|
|
} |
|
|