DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2005

    Please help with my hangman game I have encluded it in a zip file but need help badly

    i have made some progress with my hangman game but i cant keep the letter that the player chooses to remain in the label because it gets overwriten by the new letter chosen. Can anyone help me please or has anyone got a very simple hangman game that i could look at to get an idea of how it works. I have encluded some of the code that i am using for my one below also a zip file of what i have written regarding the actual game. Of course if anyone knows of an easyer way of doing things i would be very gratefull if they could show me.

    private JLabel title;

    //panel 1
    panel1.add (title);

    public void keyTyped(KeyEvent event)
    char key = event.getKeyChar();
    title .setText(""+key);

    Please help as i have been stuck on this hangman game for two weeks and am getting no where apart form getting a headache and frustrated
    Attached Files Attached Files
    Last edited by kma9; 10-29-2005 at 04:20 AM. Reason: encluded hangman zip file

  2. #2
    Join Date
    Nov 2004

    This works fine in IE

    ...but fails miserably in Opera, hmm..?

    public void keyTyped(KeyEvent event) {
        char key = event.getKeyChar();
        String s=title.getText().trim();
        if (!s.equalsIgnoreCase("Hangman Game")) {
          title.setText(s + key);
        } else {
    eschew obfuscation

  3. #3
    Join Date
    Oct 2005
    Thanks sjalle that work great and was just what I needed. Now I just need to try to find a way of doing the rest. Thanks again you are a life saver.

Similar Threads

  1. Replies: 3
    Last Post: 03-08-2005, 11:24 PM
  2. Replies: 60
    Last Post: 09-13-2002, 05:41 PM
  3. Replies: 0
    Last Post: 04-11-2002, 06:48 PM
  4. Is There Something Difficult About VB.NET?
    By Zane Thomas in forum .NET
    Replies: 332
    Last Post: 07-09-2001, 05:48 PM
  5. Replies: 0
    Last Post: 04-03-2001, 04:32 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
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.