}
public void repaint() {
//Create base image for table
iTable = Image.createImage(WIDTH, HEIGHT);
Graphics gTable = iTable.getGraphics();
//Fill background with black
gTable.fillRect(0, 0, WIDTH, HEIGHT);
if ((screenWidth >= 220) && (screenHeight >= 300)) {
//Draw deck
gTable.drawRegion(BACK_CARD, 0, 0, BACK_CARD.getWidth(),
BACK_CARD.getHeight(), Sprite.TRANS_ROT270, 0, 0,
Graphics.TOP|Graphics.LEFT);
}
//Draw discarded
Vector discarded = table.getDiscarded();
if(discarded.size() > 1) {
int len = discarded.size();
if(len % 2 == 0) {
Image toDraw = ((Card) discarded.elementAt(len-2)).getGraphic().getRender();
gTable.drawRegion(toDraw, 0, 0, toDraw.getWidth(), toDraw.getHeight(),
Sprite.TRANS_ROT270, HX, HY, Graphics.TOP|Graphics.LEFT);
gTable.drawImage(((Card) discarded.elementAt(len-1))
.getGraphic().getRender(), VX, VY,
Graphics.TOP|Graphics.LEFT);
} else {
gTable.drawImage(
((Card) discarded.elementAt(len-2))
.getGraphic().getRender(), VX, VY,
Graphics.TOP|Graphics.LEFT);
Image toDraw = ((Card)discarded.elementAt(len-1)).getGraphic().getRender();
gTable.drawRegion(toDraw, 0, 0, toDraw.getWidth(), toDraw.getHeight(),
Sprite.TRANS_ROT270, HX, HY, Graphics.TOP|Graphics.LEFT);
}
} else {
gTable.drawImage(
((Card)discarded.elementAt(0))
.getGraphic().getRender(), VX, VY,
Graphics.TOP|Graphics.LEFT);
}
}