adding text field to the applet

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • priyankabhar
    New Member
    • May 2007
    • 1

    adding text field to the applet

    Hi,

    I am new to Java applets. I am trying to create a Hangman program. For this, I need textfields for the number of letters the word has. I wrote the following code, but it did not create any textfields. Could you kindly tell me where I am going wrong ?

    TextField letter;
    for (int i = 0; i < 5; i++){ //suppose the word is 5 letters long
    letter = new TextField(" ",1);
    add(letter);
    }

    I have written this code in the init() method.

    Thank you for your help,

    priyanka
  • rsrinivasan
    New Member
    • Mar 2007
    • 221

    #2
    Originally posted by priyankabhar
    Hi,

    I am new to Java applets. I am trying to create a Hangman program. For this, I need textfields for the number of letters the word has. I wrote the following code, but it did not create any textfields. Could you kindly tell me where I am going wrong ?

    TextField letter;
    for (int i = 0; i < 5; i++){ //suppose the word is 5 letters long
    letter = new TextField(" ",1);
    add(letter);
    }

    I have written this code in the init() method.

    Thank you for your help,

    priyanka
    Hi Priya,
    What is ur problem? I cant understand clearly. Your code displayed 5 TextBox as u expected. Whether ur program gives any error or?

    Thanks & Regards,
    Srinivas r.

    Comment

    • emekadavid
      New Member
      • Mar 2007
      • 46

      #3
      your code displayed five text fields. check the code for your frame.

      Comment

      Working...