Browse Source

Fix MouseListener

feature_solitaer_setup_GamePanel
Alexander Hartung 3 years ago
parent
commit
6c2aaeb146
  1. 13
      src/main/java/solitaer/MyMouseListener.java

13
src/main/java/solitaer/MyMouseListener.java

@ -30,13 +30,6 @@ 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");
//
// }
// // Karte, die in einem StartStack liegt
// else
if ((com instanceof Card && com.getParent() instanceof StartStack) if ((com instanceof Card && com.getParent() instanceof StartStack)
|| (com instanceof StartStack && ((StartStack) com).stackIsEmpty())) { || (com instanceof StartStack && ((StartStack) com).stackIsEmpty())) {
@ -152,6 +145,12 @@ public class MyMouseListener implements MouseInputListener {
} else { } else {
clearSaveStack(selectedStack); clearSaveStack(selectedStack);
} }
//Clear SaveStack click on SolitaerGamePanel
}else if(com instanceof SolitaerGamePanel ||
com.getParent() instanceof SolitaerGamePanel && com instanceof StartStack ){
if(saveStack.stackIsEmpty() == false) {
clearSaveStack(selectedStack);
}
} }
} }

Loading…
Cancel
Save