So I have this code for a java project and I cannot get it worked ou.docx

This preview shows page 1 - 5 out of 11 pages.

So I have this code for a java project and I cannot get it worked out to work in eclipse. I don't know how to break it apart and what parts need to be classes or seperats java files import java.awt.*; import java.awt.event.*; import javax.swing.*; public class poker2 extends JFrame { private Card deck[]; //this is an array of objects of Card type. See the Card class at the end private int currentCard; //this keeps track of the number of cards dealt private JButton dealButton, shuffleButton, testButtton; //GUI stuff, the two buttons private JTextField displayField; //GUI stuff, the textfield that displays the card dealt private JLabel statusLabel; //GUI stuff, Displays the number of cards dealt private JLabel cardback, card1, card2,card3,card4,card5,card6,card7,card8,card9,card10;//GU I stuff The labels that displays the cards private JTextField hand1TF, hand2TF; Card dealt; //this is an object of Card type for a dealt card Icon card = new ImageIcon(".\\cards\\back2.GIF"); //this is the cardback graphics file Card hand1[]; Card hand2[]; int handNums[];
int test; // set up deck of cards and GUI public poker2() { super( "5-Card Stud" ); //Title String faces[] = { "Ace", "Deuce", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King" }; String suits[] = { "Hearts", "Diamonds", "Clubs", "Spades" }; deck = new Card[ 52 ]; hand1 = new Card[5]; hand2 = new Card[5]; handNums = new int[13]; //creates array to hold 52 cards currentCard = -1; test = 4; // populate deck with Card objects for ( int count = 0; count < deck.length; count++ ) deck[ count ] = new Card( faces[ count % 13 ],suits[ count / 13 ] ); // set up GUI and event handling Container container = getContentPane(); container.setLayout( new FlowLayout() ); //Diplay the cardbacks card1 = new JLabel(); card1.setIcon(card); container.add( card1 ); card3 = new JLabel();
card3.setIcon(card);

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture