Results 1 to 3 of 3
  1. #1
    meeper3000 is offline Member
    Join Date
    Apr 2009
    Rep Power

    Default Delete

    Please Delete
    Last edited by meeper3000; 11-21-2010 at 06:10 PM. Reason: Delete

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Blog Entries
    Rep Power


    I haven't gone through all of your code, but a couple of things leap out at me:

    1) Do you ever construct a Deck object? If not, you'll get a NullPointerException whenever you try to use your Deck object.
    2) You seem to be trying to use AWT components (i.e., Buttons) in a Swing app (JApplet). This can cause unwanted side effects and should be avoided. Make this a pure Swing app, and only use Swing components (such as JButtons).
    3) Also, when posting code here, please use code tags so that your code will retain its formatting and thus will be readable -- after all, your goal is to get as many people to read your post and understand your code as possible, right?

    To do this, highlight your pasted code (please be sure that it is already formatted when you paste it into the forum; the code tags don't magically format unformatted code) and then press the code button, and your code will have tags.

    Another way to do this is to manually place the tags into your code by placing the tag [code] above your pasted code and the tag [/code] below your pasted code like so:

    Java Code:
      // your code goes here
      // notice how the top and bottom tags are different
    Best of luck,


  3. #3
    corlettk is offline Member
    Join Date
    Apr 2009
    Rep Power

    Default Well display them already already!


    I suggest that (fore now atleast) you should
    1. just add a couple of JLabels to your frame.
    2. Create a displayHands(); method which sets the text of each JLabel to the string value of the associated hand
    3. and add a toString method to your Hand class, which just iterates the values (until null) and appends the value of each card to a StringBuffer.

    That's how I tackled it... it works well enough for now.

    Later on you can come back and add pictures for the cards, and workout how to lay them out (overlapping) on the screen... but for now I think you should be concentrating on the rules of the game... Blackjack is nice little logic problem.

    BTW... I like your addCard method maintains the value... nice.

    Cheers. Keith.

Similar Threads

  1. Simple Program
    By TheRocket in forum Advanced Java
    Replies: 15
    Last Post: 12-30-2008, 02:35 PM
  2. Need Help With VERY Simple Program -- Newbie!!!
    By somethingfast in forum New To Java
    Replies: 17
    Last Post: 11-25-2008, 07:38 AM
  3. Stuck - simple program
    By dirtycash in forum New To Java
    Replies: 4
    Last Post: 11-24-2008, 07:44 PM
  4. BlackJack help please,, adding hand values
    By javakid9000 in forum New To Java
    Replies: 1
    Last Post: 11-18-2007, 04:26 AM
  5. help with simple program in java
    By katie in forum New To Java
    Replies: 2
    Last Post: 08-06-2007, 08:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts