Hello, I'm new to this forum so sorry if it's a simple problem. I have been working on a program that is a hangman game in an applet:
Java Code:
import java.applet.Applet;
import javax.swing.JApplet;
import java.awt.Image;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;

public class Main extends Applet implements KeyListener
{
    final int APPLET_WIDTH = 640;
    final int APPLET_HEIGHT = 512;
    final int MAX = 40;
    Image welcome, blank, state1, state2, state3, state4, state5, state6, dead, dash;
    hangman hangman=new hangman();
    char guess;
    boolean keyPressed=false;
    int count=0;
    char[] word=hangman.wordCreator();
    // init - method is called the first time you enter the HTML site with the applet
    public void init()
    {
        welcome = getImage(getDocumentBase(),"welcome.gif.GIF");
        blank = getImage(getDocumentBase(), "BLANK.GIF");
        state1 = getImage(getDocumentBase(), "HEAD.GIF");
        state2 = getImage(getDocumentBase(), "TORSO.GIF");
        state3 = getImage(getDocumentBase(), "LEFT_LEG.GIF");
        state4 = getImage(getDocumentBase(), "RIGHT_LEG.GIF");
        state5 = getImage(getDocumentBase(), "RIGHT_ARM.GIF");
        state6 = getImage(getDocumentBase(), "FULL_BODY.GIF");
        dead = getImage(getDocumentBase(), "DEAD.GIF");
        dash = getImage(getDocumentBase(), "DASH.GIF");
        
        setSize(APPLET_WIDTH, APPLET_HEIGHT);
    }

    public void start()
    {}

    public void stop()
    {}

    public void destroy()
    {
        
    }
    
    public void keyTyped(KeyEvent event)
    {
        int id=event.getKeyCode();
        if (id == KeyEvent.VK_A)
        {
            guess='A';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_B)
        {
            guess='B';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_C)
        {
            guess='C';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_D)
        {
            guess='D';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_E)
        {
            guess='E';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_F)
        {
            guess='F';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_G)
        {
            guess='G';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_H)
        {
            guess='H';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_I)
        {
            guess='I';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_J)
        {
            guess='J';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_K)
        {
            guess='K';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_L)
        {
            guess='L';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_M)
        {
            guess='M';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_N)
        {
            guess='N';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_O)
        {
            guess='O';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_P)
        {
            guess='P';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_Q)
        {
            guess='Q';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_R)
        {
            guess='R';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_S)
        {
            guess='S';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_T)
        {
            guess='T';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_U)
        {
            guess='U';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_V)
        {
            guess='V';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_W)
        {
            guess='W';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_X)
        {
            guess='X';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_Y)
        {
            guess='Y';
            keyPressed=true;
        }
        else if (id == KeyEvent.VK_Z)
        {
            guess='Z';
            keyPressed=true;
        }
        keyPressed=false;
        count++;
        repaint();
    }
    
    public void paint(Graphics page)
    {
        int wordsize=word.length*77;
        int midpoint=APPLET_WIDTH/2;
        if(count<1)
        {
            page.drawImage(welcome, 0, 0, this);
            try
            {
                Thread.sleep(2000);
            }
            catch(InterruptedException e)
            {
            }
        }

        page.drawImage(blank, 0, 0, this);

        for (int i=0; i<wordsize; i+=77)
        {
            page.drawImage(dash, (midpoint-(wordsize/2))+i, 100, this);
        }

        page.setColor(Color.white);
        Font f1=new Font("Times New Roman", Font.PLAIN, 50);
        page.setFont(f1);
        addKeyListener(this);
        if(count>0&&count<6)
        {
            for(int i=0; i<wordsize; i+=77)
            {
                if((word[i/77])==guess)
                {
                    page.drawString(""+word[i/77], (midpoint-(wordsize/2))+i+(77/4), 100);
                }
            }
        }
        keyPressed=false;
    }

    public void keyReleased(KeyEvent event){}
    public void keyPressed(KeyEvent event){}

}
Now I am fairly new to java in general, so I apologize for anythign redundant or unnecessary. The problem is the "if((word[i/77])==guess)" line. This line should compare the two chars, one from the word array and one from KeyTyped. But through debugging, it seems as if the guess char is not being properly assigned. Thanks for any help or advice you can give me, even if it's about another part of my code unrelated to my problem. :)