import SkipBoWrapper; import java.lang.*; import java.awt.*; /* This frame displays an explanation of the card game. It also provides its own close button. The set text routine is ugly, but I haven't figured out how handle it more cleanly yet. This one will be updated in the future. */ public class InfoFrame extends Frame { Font f = new Font("TimesRoman",Font.BOLD,16); Panel bottom = new Panel (); TextArea out = new TextArea (20,40); public InfoFrame () { super("SkipBo Card Game Information"); this.setLayout(new BorderLayout()); this.setFont(f); this.setBackground(Color.lightGray); out.setBackground(Color.white); out.setEditable(false); this.setForeground(Color.black); bottom.setLayout(new FlowLayout()); Button button = new Button("Close"); button.setBackground(Color.blue); button.setForeground(Color.yellow); bottom.add(button); this.add("South", bottom); this.add("Center", out); addText(out); } public boolean action (Event evt, Object what) { String label = (String)what; if (evt.target instanceof Button) { if (label.equals ("Close")) { if (this.isShowing ()) this.hide (); return true; } } return false; } private void addText (TextArea out) /* Writes text in the output field */ { out.setText("\t\t Welcome to SkipBo\n"); out.appendText(" The objective of the game is to be the first player to"); out.appendText(" play all cards \n from your store stack.\n\n"); out.appendText(" The game is played with several decks of standard "); out.appendText("playing cards \n shuffled together. "); out.appendText("Each deck consists of 4 sets with card ranks: \n A, 2, "); out.appendText("3, 4, 5, 6, 7, 8, 9, T, J, Q, and K."); out.appendText(" There are also two wildcards.\n"); out.appendText(" The suit of cards is irrelevant in this game.\n\n"); out.appendText(" Each Player has a hand of five cards, their store stack, and four discard\n stacks. The goal is to play cards from your store, hand, and discards to\n the build stack in sequence and to play all the cards from your store stack\n as quickly as possible. When you cannot play anymore cards to the build\n stack, you must end your turn by placing a card from your hand onto a\n discard stack. The first player to empty their store stack wins. \n\n"); out.appendText(" To start the game, choose the size of your store stacks (between 1 and 20\n cards) and enter your player names. To play the computer, leave the\n Player2 name blank. To play a card\n\t1. Click on the card you wish to move.\n\t2. Click on your destination\n\t3. Click on any invalid area to reset.\n\t4. Be careful and track where you have clicked.\n\n NOTE: The computer will play quickly. Watch the window for the computer's\n moves and watch the changes to the build stacks."); } }