Results 1 to 3 of 3

Thread: spell check

  1. #1
    kazitula is offline Member
    Join Date
    Oct 2007
    Posts
    10
    Rep Power
    0

    Lightbulb spell check

    suppose in an applet, I've one button n one text field, and I've also a file where 10 words has been stored, now if anyone wants to check is the written word is correctly spelled or not by pressing the button, then how can I do this?

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

    Default

    Java Code:
    //  <applet code="SpellCheck" width="300" height="200"></applet>
    //  use: >appletviewer SpellCheck.java
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;;
    
    public class SpellCheck extends JApplet implements ActionListener {
        JTextField textField;
        String[] words = new String[10];
    
        public void init() {
            // read file and store the 10 "words" in the words array.
            textField = new JTextField(16);
            textField.addActionListener(this);
            JPanel first = new JPanel();
            first.add(textField);
            JButton button = new JButton("check");
            button.addActionListener(this);
            JPanel last = new JPanel();
            last.add(button);
            getContentPane().add(first, BorderLayout.PAGE_START);
            getContentPane().add(last, BorderLayout.PAGE_END);
        }
    
        public void actionPerformed(ActionEvent e) {
            String text = textField.getText();
            System.out.println("text = " + text);
            checkSpelling(text);
        }
    
        private void checkSpelling(String s) {
            // Run through the words array and test the
            // variable "s" against each word in the list
            // that begins with the same first letter as
            // "s" has. Print the results of your test.
        }
    }

  3. #3
    kazitula is offline Member
    Join Date
    Oct 2007
    Posts
    10
    Rep Power
    0

    Default

    thank you sooooo much
    but I can't understand the following lines, can anyone plz explain it?

    private void checkSpelling(String s) {
    // Run through the words array and test the
    // variable "s" against each word in the list
    // that begins with the same first letter as
    // "s" has. Print the results of your test.
    }

Similar Threads

  1. How to check whether file is exists or not
    By Java Tip in forum java.io
    Replies: 0
    Last Post: 04-05-2008, 11:13 AM
  2. CRC check program 1 error
    By javakid9000 in forum New To Java
    Replies: 1
    Last Post: 03-19-2008, 06:04 AM
  3. Check if a web page exists or not
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-02-2008, 08:24 PM
  4. Can someone check my code
    By joz_12345 in forum Java 2D
    Replies: 7
    Last Post: 02-18-2008, 03:58 AM
  5. Spell check feature
    By ravian in forum Advanced Java
    Replies: 2
    Last Post: 12-27-2007, 10:28 AM

Posting Permissions

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