diff --git a/src/main/java/solitaer/MyMouseListener.java b/src/main/java/solitaer/MyMouseListener.java new file mode 100644 index 0000000..a5db8af --- /dev/null +++ b/src/main/java/solitaer/MyMouseListener.java @@ -0,0 +1,60 @@ +package solitaer; + +import java.awt.Component; +import java.awt.event.MouseEvent; + +import javax.swing.SwingUtilities; +import javax.swing.event.MouseInputListener; + +public class MyMouseListener implements MouseInputListener { + + @Override + public void mouseClicked(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent e) { + // TODO Auto-generated method stub + System.out.println("DOWN"); + Component com = SwingUtilities.getDeepestComponentAt( + e.getComponent(), e.getX(), e.getY()); + System.out.println("########"); + System.out.println(com.toString()); + System.out.println(com.getParent().toString()); + System.out.println("########"); + + } + + @Override + public void mouseReleased(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseEntered(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseDragged(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseMoved(MouseEvent e) { + // TODO Auto-generated method stub + + } + +} diff --git a/src/main/java/solitaer/SolitaerGamePanel.java b/src/main/java/solitaer/SolitaerGamePanel.java index 3577a3a..bfe5a90 100644 --- a/src/main/java/solitaer/SolitaerGamePanel.java +++ b/src/main/java/solitaer/SolitaerGamePanel.java @@ -7,17 +7,26 @@ import javax.swing.JPanel; public class SolitaerGamePanel extends JPanel { - /** - * - */ private static final long serialVersionUID = 1L; + private CardDeck deck; + private MyMouseListener mouseL; public SolitaerGamePanel() { setLayout(null); + + mouseL = new MyMouseListener(); + this.addMouseListener(mouseL); + + + deck = new CardDeck(); + + + StartStack a = new StartStack(25,25); - a.addCard(new Card(13, Symbol.Karo, true)); - a.addCard(new Card(1, Symbol.Karo, true)); + a.addCard(deck.getDeck().get(0)); + deck.getDeck().get(1).setFaceUp(true); + a.addCard((deck.getDeck().get(1))); this.add(a); StartStack b = new StartStack(200,25);