Browse Source

Set Layout StartStacks

feature_solitaer_setup_GamePanel
Alexander Hartung 3 years ago
parent
commit
a0409b6b94
  1. 92
      src/main/java/solitaer/SolitaerGamePanel.java

92
src/main/java/solitaer/SolitaerGamePanel.java

@ -8,10 +8,19 @@ import javax.swing.JPanel;
public class SolitaerGamePanel extends JPanel { public class SolitaerGamePanel extends JPanel {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final int OFFSET_STACKS = 5;
public final int IMAGE_WIDTH = 72;
public final int IMAGE_HIGHT = 96;
private CardDeck deck; private CardDeck deck;
private MyMouseListener mouseL; private MyMouseListener mouseL;
private SaveStack save =new SaveStack(500,250); private SaveStack save =new SaveStack(500,250);
private StartStack[] start = new StartStack[7] ;
public SolitaerGamePanel() { public SolitaerGamePanel() {
@ -20,48 +29,53 @@ public class SolitaerGamePanel extends JPanel {
mouseL = new MyMouseListener(save); mouseL = new MyMouseListener(save);
this.addMouseListener(mouseL); this.addMouseListener(mouseL);
deck = new CardDeck(); deck = new CardDeck();
StartStack a = new StartStack(25,125);
deck.getDeck().get(5).setFaceUp(true);
a.addCard((deck.getDeck().get(5)));
deck.getDeck().get(4).setFaceUp(true);
a.addCard((deck.getDeck().get(4)));
deck.getDeck().get(3).setFaceUp(true);
a.addCard((deck.getDeck().get(3)));
deck.getDeck().get(2).setFaceUp(true);
a.addCard((deck.getDeck().get(2)));
deck.getDeck().get(1).setFaceUp(true);
a.addCard((deck.getDeck().get(1)));
deck.getDeck().get(0).setFaceUp(true);
a.addCard(deck.getDeck().get(0));
this.add(a);
StartStack b = new StartStack(200,125);
deck.getDeck().get(32).setFaceUp(true);
b.addCard((deck.getDeck().get(32)));
this.add(b);
StartStack c = new StartStack(375,125);
//deck.getDeck().get(20).setFaceUp(true);
c.addCard((deck.getDeck().get(20)));
this.add(c);
StartStack d = new StartStack(475,125);
this.add(d);
for(int i = 0; i<7; i++) {
int x = (((IMAGE_WIDTH+OFFSET_STACKS)*i)+OFFSET_STACKS);
System.out.println(x);
start[i] = new StartStack(x, 125);
this.add(start[i]);
}
// StartStack a = new StartStack(25,125);
//
// deck.getDeck().get(5).setFaceUp(true);
// a.addCard((deck.getDeck().get(5)));
//
// deck.getDeck().get(4).setFaceUp(true);
// a.addCard((deck.getDeck().get(4)));
//
// deck.getDeck().get(3).setFaceUp(true);
// a.addCard((deck.getDeck().get(3)));
//
// deck.getDeck().get(2).setFaceUp(true);
// a.addCard((deck.getDeck().get(2)));
//
// deck.getDeck().get(1).setFaceUp(true);
// a.addCard((deck.getDeck().get(1)));
//
// deck.getDeck().get(0).setFaceUp(true);
// a.addCard(deck.getDeck().get(0));
//
// this.add(a);
//
// StartStack b = new StartStack(200,125);
//
// deck.getDeck().get(32).setFaceUp(true);
// b.addCard((deck.getDeck().get(32)));
// this.add(b);
//
// StartStack c = new StartStack(375,125);
//
// //deck.getDeck().get(20).setFaceUp(true);
// c.addCard((deck.getDeck().get(20)));
// this.add(c);
//
//
// StartStack d = new StartStack(475,125);
// this.add(d);
//save = new SaveStack(500,250); //save = new SaveStack(500,250);
this.add(save); this.add(save);

Loading…
Cancel
Save