Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-06-2007, 12:31 AM
Member
 
Join Date: Oct 2007
Posts: 10
Rep Power: 0
kazitula is on a distinguished road
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?
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 12-06-2007, 02:21 AM
hardwired's Avatar
Senior Member
 
Join Date: Jul 2007
Posts: 1,577
Rep Power: 4
hardwired is on a distinguished road
Default
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.
    }
}
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 12-20-2007, 12:37 PM
Member
 
Join Date: Oct 2007
Posts: 10
Rep Power: 0
kazitula is on a distinguished road
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.
}
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT +2. The time now is 12:53 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org