Results 1 to 2 of 2
  1. #1
    sydneytot is offline Member
    Join Date
    Jan 2011
    Posts
    1
    Rep Power
    0

    Default Applet guess the letter in the textbox

    Can you help me in this program java applet. this is a program that the user will input one letter in all the textbox.When you typed all the letters correctly in all the textbox and you will click the button and will prompt accepted else if one of your inputted letter is wrong it will prompt Invalid. The letters in every textbox is fixed: A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,,W,X,Y

    this is my codes:


    Java Code:
    package waley;
    
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    
    public class guess extends JApplet implements ActionListener {
    
    // The output field is where the currentValue is displayed
    private Button submitButton;
    private TextField textbox,textbox1,textbox2,textbox3,textbox4,textbox5,
    textbox6,textbox7,textbox8,textbox9,textbox10,textbox11,
    textbox12,textbox13,textbox14,textbox15,textbox16,textbox17,
    textbox18,textbox19,textbox20,textbox21,textbox22,textbox23,textbox24,
    textbox25;
    
    
    
    public void init() {
    
    Container contentPane = this;
    contentPane.setBackground(Color.lightGray);
    BorderLayout bLayout = new BorderLayout();
    
    // Set up the outputField and add it to the contentPane
    Font font = new Font("Serif",Font.PLAIN,16);
    submitButton = new Button("SUBMIT");
    submitButton.setBackground(Color.white);
    submitButton.setFont(font);
    submitButton.addActionListener(this);
    contentPane.add(submitButton,BorderLayout.SOUTH);
    
    // Prepare the textPanel
    Panel textPanel = new Panel();
    textPanel.setBackground(Color.lightGray);
    GridLayout gLayout = new GridLayout(5,5);
    textPanel.setLayout(gLayout);
    
    // Add all the textbox to the textPanel
    textbox = new TextField();
    textPanel.add(textbox);
    textbox1 = new TextField();
    textPanel.add(textbox1);
    textbox2 = new TextField();
    textPanel.add(textbox2);
    textbox3 = new TextField();
    textPanel.add(textbox3);
    textbox4 = new TextField();
    textPanel.add(textbox4);
    textbox5 = new TextField();
    textPanel.add(textbox5);
    textbox6 = new TextField();
    textPanel.add(textbox6);
    textbox7 = new TextField();
    textPanel.add(textbox7);
    textbox8 = new TextField();
    textPanel.add(textbox8);
    textbox9 = new TextField();
    textPanel.add(textbox9);
    textbox10 = new TextField();
    textPanel.add(textbox10);
    textbox11 = new TextField();
    textPanel.add(textbox11);
    textbox12 = new TextField();
    textPanel.add(textbox12);
    textbox13 = new TextField();
    textPanel.add(textbox13);
    textbox14 = new TextField();
    textPanel.add(textbox14);
    textbox15 = new TextField();
    textPanel.add(textbox15);
    textbox16 = new TextField();
    textPanel.add(textbox16);
    textbox17 = new TextField();
    textPanel.add(textbox17);
    textbox18 = new TextField();
    textPanel.add(textbox18);
    textbox19 = new TextField();
    textPanel.add(textbox19);
    textbox20 = new TextField();
    textPanel.add(textbox20);
    textbox21 = new TextField();
    textPanel.add(textbox21);
    textbox22 = new TextField();
    textPanel.add(textbox22);
    textbox23 = new TextField();
    textPanel.add(textbox23);
    textbox24 = new TextField();
    textPanel.add(textbox24);
    
    
    
    
    // Finally, add the textPanel to the contentPane
    contentPane.add(textPanel);
    }//init
    
    public void actionPerformed(ActionEvent e){
    
    
    
    
    }
    }//guess applet
    Moderator Edit: Code tags added
    Last edited by Fubarable; 01-22-2011 at 03:32 PM. Reason: Moderator Edit: Code tags added

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by sydneytot View Post
    Can you help me in this program java applet.
    Sure, but you have to ask a question for us to help you, and all you've done is posted an assignment and some unformatted code -- basically a homework dump. Please ask a specific question and you'll likely get a specific answer. Also, you'll want to add code tags to your post to help others be able to read your code.

    Edit: I've added code tags to your post above, but your code is all unformatted without indentation and so remains difficult to read. You will probably want to repost your code with formatted code.

    Luck.
    Last edited by Fubarable; 01-22-2011 at 03:33 PM.

Similar Threads

  1. Guess Character
    By pinkdreammsss in forum Java Applets
    Replies: 14
    Last Post: 05-05-2010, 08:28 PM
  2. resultset.next() = false ;; Can't Guess why.. please help.
    By Stephen Douglas in forum New To Java
    Replies: 11
    Last Post: 04-12-2010, 11:21 AM
  3. Help about Guess the Numbers Program in java
    By macfrik in forum New To Java
    Replies: 6
    Last Post: 03-25-2009, 04:59 AM
  4. guess number game
    By mistah in forum New To Java
    Replies: 10
    Last Post: 11-23-2008, 04:37 AM
  5. sample of guess high and low game
    By pouria62 in forum AWT / Swing
    Replies: 1
    Last Post: 10-26-2008, 01:57 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
  •