Browse Source

ADD Cards to StartStacks

feature_solitaer_setup_GamePanel
Alexander Hartung 3 years ago
parent
commit
3576bf0370
  1. 34
      src/main/java/solitaer/SolitaerGamePanel.java

34
src/main/java/solitaer/SolitaerGamePanel.java

@ -33,16 +33,39 @@ public class SolitaerGamePanel extends JPanel {
public SolitaerGamePanel() { public SolitaerGamePanel() {
setLayout(null); setLayout(null);
int Offset_x_Save = setLayoutX(STARTSTACK_SIZE + 1);
int Offset_y_Save = setLayouty(1);
JLabel label = new JLabel();
label.setText("selected Cards");
label.setBounds(Offset_x_Save, Offset_y_Save - 25, 200, 25);
this.add(label);
save = new SaveStack(Offset_x_Save, Offset_y_Save);
this.add(save);
mouseL = new MyMouseListener(save); mouseL = new MyMouseListener(save);
this.addMouseListener(mouseL); this.addMouseListener(mouseL);
deck = new CardDeck(); deck = new CardDeck();
System.out.println(deck.getDeck().size());
for (int i = 0; i < STARTSTACK_SIZE; i++) { for (int i = 0; i < STARTSTACK_SIZE; i++) {
int y = setLayouty(1); int y = setLayouty(1);
start[i] = new StartStack(setLayoutX(i), y); start[i] = new StartStack(setLayoutX(i), y);
int tmp = i;
while(tmp != 0) {
start[i].addCard(deck.getDeck().remove(0));
tmp -= 1;
}
Card card = deck.getDeck().remove(0);
card.setFaceUp(true);
start[i].addCard(card);
this.add(start[i]); this.add(start[i]);
} }
System.out.println(deck.getDeck().size());
for (int i = 0; i < ABLAGESTACK_SIZE; i++) { for (int i = 0; i < ABLAGESTACK_SIZE; i++) {
int x = setLayoutX(((STARTSTACK_SIZE - ABLAGESTACK_SIZE) + i)); int x = setLayoutX(((STARTSTACK_SIZE - ABLAGESTACK_SIZE) + i));
@ -67,17 +90,6 @@ public class SolitaerGamePanel extends JPanel {
this.add(ablage[i]); this.add(ablage[i]);
} }
int Offset_x_Save = setLayoutX(STARTSTACK_SIZE + 1);
int Offset_y_Save = setLayouty(1);
JLabel label = new JLabel();
label.setText("selected Cards");
label.setBounds(Offset_x_Save, Offset_y_Save - 25, 200, 25);
this.add(label);
save = new SaveStack(Offset_x_Save, Offset_y_Save);
this.add(save);
waste = new WasteStack(setLayoutX(1), OFFSET_STACKS_Y); waste = new WasteStack(setLayoutX(1), OFFSET_STACKS_Y);
geber = new GeberStack(setLayoutX(0), OFFSET_STACKS_Y, waste); geber = new GeberStack(setLayoutX(0), OFFSET_STACKS_Y, waste);
this.add(waste); this.add(waste);

Loading…
Cancel
Save