Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-06-2007, 12:31 AM
Member
 
Join Date: Oct 2007
Posts: 10
kazitula is on a distinguished road
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
Sponsored Links
  #2 (permalink)  
Old 12-06-2007, 02:21 AM
Senior Member
 
Join Date: Jul 2007
Posts: 1,029
hardwired is on a distinguished road
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
kazitula is on a distinguished road
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
Sponsored Links
Reply


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

vB 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 +3. The time now is 05:49 AM.


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