Hi everybody,

I am planning to build a java programe named word counter. It shall have file view and help menu. A text field where user can type or paste text. A button which starts counting number of words in the text. and a text field where the total number of words will appear.I just wrote small program using swing joptionpane that counts words but it doesn't look like much a stand alone programe. So what i need to write a program.Is there anyone can help me with matter. I will be thankful to him so much. I also have drawing to illustrate my program so I am attaching that one with this post.

regards
dreams.

Edited 6 Years Ago by dreamslct: n/a

Attachments Word_Counter.jpg 17.27 KB

Well, lets see your code, but, to tell you the truth it is nothing but a small, simple GUI, a FileReader and String's split method.

Hi there,
Pleasure seeing your reply to my post. Also if you could help me with code I will be so thankful to you


dreams.

If by that you mean "can I write it for you", no I can't. Post your attempt here and I will help you correct. I will suggest a borderlayout with the textarea in the center, the top part as a panel with flow layout north and ananlog for the bottom and south.

Hi, i saw your reply to my problem.

Here is a chunk that i wrote in java with joptionpane class.

import javax.swing.joptionpane;

                public class WordCounter {

           public static void main (String [] args) {

          string str;
          str = joptionpane.shwoInputDialog("Enter text here ! ");
          string[] mystring = str.split("\\s+");
  JoptionPane.showmessagedialog(null, "Words " + mystirng.length);
       System.exit(0);
}

}

======================================================================

but i don't know how to do this with jframe , could you help me with this.

Edited 6 Years Ago by peter_budo: Keep It Clear - Do wrap your programming code blocks within [code] ... [/code] tags

Okay? So the "theory" is there (maybe). But I still need to see at least the attempt at a GUI (which JOptionPane in that manner, IMHO, is not). There is a huge difference. You will need to manage a couple of layouts and use an actionlistener and add components to the containers none of which are necessary for JOptionPane and I am not going to do that for you, as I alredy said). I can guarantee you've already covered this stuff in your class.

This article has been dead for over six months. Start a new discussion instead.