Browse Source

Add render for GeberStack

feature_solitaer_Geber-_WasteStack
Alexander Hartung 3 years ago
parent
commit
f95187e009
  1. 19
      src/main/java/solitaer/GeberStack.java
  2. 7
      src/main/java/solitaer/SolitaerGamePanel.java

19
src/main/java/solitaer/GeberStack.java

@ -1,5 +1,8 @@
package solitaer;
import java.awt.Color;
import java.awt.Graphics;
public class GeberStack extends BaseStack {
private static final long serialVersionUID = 1L;
@ -22,4 +25,20 @@ public class GeberStack extends BaseStack {
return false;
}
@Override
protected void paintComponent(Graphics g) {
// TODO Auto-generated method stub
super.paintComponent(g);
if (stackIsEmpty()) {
g.setColor(Color.pink);
g.fillRect(0, 0, this.getWidth(), IMAGE_HIGHT);
g.setColor(Color.black);
g.drawRect(0, 0, this.getWidth() - 1, IMAGE_HIGHT - 1);
String text = "Start\nAgain";
g.drawString(text, 5, this.IMAGE_HIGHT/2);
}
}
}

7
src/main/java/solitaer/SolitaerGamePanel.java

@ -77,6 +77,13 @@ public class SolitaerGamePanel extends JPanel {
this.add(a4);
WasteStack w = new WasteStack(85, 10);
GeberStack g = new GeberStack(10, 10, w);
this.add(w);
this.add(g);
}

Loading…
Cancel
Save