Insert word count

Is there a way to insert word count? I have some professors that want a word count and I wanted to know if there was an "insert word count" somewhere?

No, there isn't. Can't you write it by hand?
Remember that Pages counts different to how MS Word does.
_http://discussions.apple.com/thread.jspa?messageID=10937776_
And read this thread _http://discussions.apple.com/thread.jspa?messageID=10877817_

Similar Messages

  • Putting Word Count in Pages Document

    Is there a way to insert a document's current word count directly into the body of the document? In other words, is there a way to do the equivalent of "Insert Page Number" or "Insert Page Count" for word count?

    PeterBreis0807 wrote:
    See *How to Insert Current Weather and Word Count into Your Document* p307 in the Pages09_UserGuide.pdf downloadable from under the Help menu.
    Peter
    It's dificult to read page 307 in a guide containing 266 pages.
    On page 37 I may read how to view word count and other document statistics but,
    - I saw nothing about current weather
    - I saw nothing about a way to insert the word count in the document as it was asked by the OP
    As far as I know,
    we may insert page num, page count, date time, file name
    but we only
    may display word count.
    Yvan KOENIG (from FRANCE mercredi 27 mai 2009 18:21:12)

  • InDesign CS6, Formulare - Wortzahl für ein Feld definieren / Define word count for a form field

    Ich habe folgende Frage: Ist es mit inDesign CS6 möglich, ein interaktives PDF zu kreieren, in dem die zulässige Wortzahl in einem Feld genau definiert wird?
    Im speziellen Fall möchte ich ein Eingabefeld auf eine DIN A4 Seite setzen, welches exakt 350 Wörter erfordert, um die Seite druckbar zu machen... Mehr Wörter sollten nicht eingegeben werden können und sollten es weniger sein, ist ein Drucken nicht möglich...
    I have the following question: Does InDesign CS6 offer am option to create an interactive PDF with a text/form field which allows ONLY a defined number of words?
    In this particular case I would like to create a DIN A4 page with a file dwhich allows for exactly 350 words to make the document printable. If one put's in less than 350 printing should be disallowed and at the same time it should be impossible to type more than the allowed number of words.
    Jörg Hippo Thomsen

    Hi Steve!
    Thanks to a google search I have managed to solve the issue flawlessly
    Look  at this little java script:
    var val = event.value + event.change,
    matches = val.match(/\b[\w\-\']+\b/g),
    count = matches.length;
    this.getField("charCount").value = count;
    if (count > 90) { app.alert("You have exceeded the maximum of 90 words for this text field.") }
    1. This script needs to be inserted under Properties/Format/Custom/Custom Key Stroke Script.
    2. One creates a second fiield namend charCount to display the word count.
    Voila! The text field will pop up a warning if the allowed maximum word count is exceeded and it will display the word count in the extra field

  • Oracle Text word count in 10g?

    Given a clob column full of text in 10g and a particular word, is there a way to return the frequency (word count) of this word in the documents search? Not a count of the records returned but an actual count of the number of times the word is in the documents searched. I couldn't seem to find how in the Oracle text documentation, seems like it would be a simple operation, so I may be looking in the wrong place. Any tips?

    In 10g, you can specify algorithm="count" within a query template. I have demonstrated in 11g below, but have used it in 10g previously and it is in the 10g documentaiton.
    SCOTT@orcl_11g> drop table t;
    Table dropped.
    SCOTT@orcl_11g>
    SCOTT@orcl_11g> create table t (id varchar2(20) primary key, text varchar2(2000));
    Table created.
    SCOTT@orcl_11g>
    SCOTT@orcl_11g> insert into t values ('1', 'the cat cat cat dog dog sat on the big brown mat');
    1 row created.
    SCOTT@orcl_11g> insert into t values ('2', 'the big brown mat sat on the big brown mat');
    1 row created.
    SCOTT@orcl_11g>
    SCOTT@orcl_11g> create index ti on t(text) indextype is ctxsys.context;
    Index created.
    SCOTT@orcl_11g>
    SCOTT@orcl_11g> variable search_string varchar2(10)
    SCOTT@orcl_11g> exec :search_string := 'cat'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g> select :search_string, id, score (0) as frequency_count
      2  from   t
      3  where  contains
      4             (text,
      5              '<query>
      6              <textquery lang="ENGLISH" grammar="CONTEXT">'
      7              || :search_string ||
      8             '</textquery>
      9              <score datatype="INTEGER" algorithm="COUNT"/>
    10            </query>',
    11              0) > 0
    12  /
    :SEARCH_STRING                   ID                   FREQUENCY_COUNT
    cat                              1                                  3
    SCOTT@orcl_11g> exec :search_string := 'cat dog'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g> /
    :SEARCH_STRING                   ID                   FREQUENCY_COUNT
    cat dog                          1                                  1
    SCOTT@orcl_11g> exec :search_string := 'brown mat'
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g> /
    :SEARCH_STRING                   ID                   FREQUENCY_COUNT
    brown mat                        1                                  1
    brown mat                        2                                  2
    SCOTT@orcl_11g>

  • Array words count

    Hi guys
    This code is giving me this output
    The New York Times is an American daily newspaper founded and continuously published in New York City since September 18 1851 It has won 112 Pulitzer Prizes more than any other news organization 0
    I need to read and split the array (I believe that part works)
    I also need to count the words and display it like this
    The(1)  New(2) York(2) Times(1) is (1) ...etc
    I am   System.out.print(token + " "  ) ; then I need to count the words and display the number in front
    Thank you
    package test4;
    import java.util.StringTokenizer;
    * @author rechever
    public class Test4 {
         * @param args the command line arguments
        public static void main (String[] args) {
           System.out.println("Displaying a paragraph: ”): ");
                String sentence1 = "The New York Times is an American daily newspaper, founded and continuously published "
                        + "in New York City since September 18, 1851. It has won 112 Pulitzer Prizes, more than any other news organization";
        //        String sentence1  = scanner.nextLine();
          /* regular expression   */
          sentence1 = sentence1.replaceAll("\\,"," ");
          sentence1 = sentence1.replaceAll("\\."," ");
          sentence1 = sentence1.replaceAll("\\;"," ");
                StringTokenizer stt = new StringTokenizer(sentence1," ");
              // int countWords = 1;  
                while
                    (stt.hasMoreTokens()){
                    String token = stt.nextToken();
                   System.out.print(token + " "  ) ;
                 // String  value = sentence1;
                 //  String value = token;
              //  insertNode(value);
              //  insertNode(value);
                for(int countWords = 0; countWords < sentence1.length(); countWords++ ) {
           if(sentence1.isEmpty()) {
             System.out.println(countWords);
                } // end of Main  

    Believe I try before I ask, if you see the code I was able to split the array, I am having problems with the counts and displaying the results in front of the words..
    as you can see I initiated the loop, I just can not get it to work...
    for(int countWords = 0; countWords < sentence1.length(); countWords++ ) {
           if(sentence1.isEmpty()) {
             System.out.println(countWords);
                } // end of Main 
    I need to able to split the array
    StringTokenizer stt = new StringTokenizer(sentence1," ");
              // int countWords = 1;  
                while
                    (stt.hasMoreTokens()){
                    String token = stt.nextToken();
                   System.out.print(token + " "  ) ;
    then after the array split I need to counts the words,
    this 
    for(int countWords = 0; countWords < sentence1.length(); countWords++ ) {
           if(sentence1.isEmpty()) {
             System.out.println(countWords);
    is not doing the trick..
    I am in the business of learning, I am not looking for a free ride...I google it, I look in books
    This code is doing it but I have to call a method to insert the array in a Binary tree
    something like tree.insertNode (value)
    being value the data stoom the split array....
    Now if you want to give some ideas (a link, documentation anything of how to call a method from  a class that is using maps...that will be great
    I though that doing it in a simple array was easy... again, I just learning
    Thank you
    import java.io.PrintStream;
    import java.util.*;
    public class WordTypeCount
       public static void main( String[] args )
          // create HashMap to store String keys and Integer values
          Map< String, Integer > myMap = new HashMap< String, Integer >();
          createMap( myMap ); // create map based on user input
          displayMap( myMap ); // display map content
       } // end main
       // create map from user input
       private static void createMap( Map< String, Integer > map )
          Scanner scanner = new Scanner( System.in ); // create scanner
          System.out.println( "Please Enter the sentence from the the from Edgar Allen Poe’s “Fall of the House of Usher”):" ); // prompt for user input
          String input = scanner.nextLine();
          // tokenize the input
          String[] tokens = input.split( " ");
          // processing input text
          for ( String token : tokens )
             String word = token.toString(); 
                     ///toLowerCase(); // get lowercase word
             // if the map contains the word
             if ( map.containsKey( word ) ) // is word in map
                int count = map.get( word ); // get current count
                map.put( word, count + 1 ); // increment count
             } // end if
             else
                map.put( word, 1 ); // add new word with a count of 1 to map
          } // end for
       } // end method createMap
       // display map content
       private static void displayMap( Map< String, Integer > map )
          Set< String > keys = map.keySet(); // get keys
          // sort keys
          TreeSet< String > sortedKeys = new TreeSet<  >( keys );
          System.out.println( "\nMap contains:\nKey\t\tValue");
          // generate output for each key in map
          for ( String key : sortedKeys )
          // System.out.printf( "%-10s%10s\n", key, map.get( key ) );
          System.out.printf( "%-5s%-5s", key,map.get( key ) );
         // System.out.printf("\nsize: %d\nisEmpty: %b\n", key, map.get( key ) );
          System.out.printf(
             "\nsize: %d\nisEmpty: %b\n", map.size(), map.isEmpty() );
       } // end method displayMap
    } // end class WordTypeCount
    Thank you

  • Word Count, but only words over certain number of letter...?

    Hi,
    Does anyone know of a way to do a word count, but only count the words with a certain number of letters. For example all words with 4 letters or more?
    Thanks

    I never guessed that I will read such a question but why not ?
    --(SCRIPT word4Count.app]
    --==========
    Enregistrer le script en tant qu'Application ou Progiciel : word4count.app
    déplacer l'application créée dans le dossier
    <VolumeDeDémarrage>:Users:<votreCompte>:Library:Scripts:Applications:Pages:
    Il vous faudra peut-être créer le dossier Pages et même le dossier Applications.
    menu Scripts > Pages > word4count
    Le script affiche (ou insère à l'emplacement du curseur )
    le nombre de mots de la couche texte et
    le nombre de mots des blocs texte
    dont la longueur est supérieure à la valeur définie par la property limite.
    --=====
    L'aide du Finder explique:
    L'Utilitaire AppleScript permet d'activer le Menu des scripts :
    Ouvrez l'Utilitaire AppleScript situé dans le dossier Applications/AppleScript.
    Cochez la case "Afficher le menu des scripts dans la barre de menus".
    --=====
    Grace au programme gratuit ThisService, il est possible d'encapsuler ce script dans un service.
    Télécharger ThisService depuis:
    http://wafflesoftware.net/thisservice/
    Lors de la création du service, cliquer le bouton "Produce output".
    Il est possible d'associer un raccourci clavier au service.
    --==========
    Copy the script in the clipboard
    Paste in a blank window of Script Editor
    Save it as an Application or an Application Bundle
    Move the newly created application into the folder:
    <startup Volume>:Users:<yourAccount>:Library:Scripts:Applications:Pages:
    Now, enter your Pages document.
    Click where you want.
    Go to
    menu Scripts > Pages > word4count
    The script will count the words whose length is higher than the value stored in the property limite.
    The wordcount will be pasted at the insertion point
    --=====
    The Finder's Help explains:
    To make the Script menu appear:
    Open the AppleScript utility located in Applications/AppleScript.
    Select the "Show Script Menu in menu bar" checkbox.
    --=====
    Thanks to the free program ThisService, we may encapsulate this script in a Service.
    Download ThisService from
    http://wafflesoftware.net/thisservice/
    When creating the service click the button "Produce output"
    We may link the service to a shortcut.
    --==========
    Yvan KOENIG
    19 février 2009
    --=====
    property limite : 4
    property affiche : true
    --=====
    property theApp : "Pages"
    property ws : {}
    --=====
    on process()
    set rezult to my commun()
    tell application "System Events"
    activate
    display dialog rezult
    end tell
    return ""
    end process
    --=====
    on commun()
    local liste1, liste2, ng, c1, c2
    --set my ws to {}
    tell application "Pages" to tell document 1
    set liste1 to words of body text
    set liste2 to {}
    set ng to count of graphic
    repeat with i from 1 to ng
    tell graphic i
    try
    copy items of (get words of object text) to end of liste2
    end try
    end tell -- graphic i
    end repeat
    (* Working this way we are counting the words as they are defined by Pages *)
    end tell -- document 1 of Pages
    if liste1 is not {} then
    set my ws to liste1
    set c1 to my compte4()
    else
    set c1 to 0
    end if
    if liste2 is not {} then
    set my ws to liste2
    set c2 to my compte4()
    else
    set c2 to 0
    end if
    set my ws to {}
    if my parlefrancais() then
    return "Nombre de mots dont la longueur dépasse " & limite & return & "dans la couche texte : " & c1 & return & "dans des blocs : " & c2
    else
    return "Count of words whose length is greater than " & limite & return & "in text layer : " & c1 & return & "in text blocks : " & c2
    end if
    end commun
    --=====
    on compte4()
    local wc, w
    set wc to 0
    repeat with w in my ws
    if length of (w as text) > limite then set wc to wc + 1
    end repeat
    return wc
    end compte4
    --=====
    on parlefrancais()
    local z
    try
    tell application theApp to set z to localized string "Cancel"
    on error
    set z to "Cancel"
    end try
    return (z = "Annuler")
    end parlefrancais
    --=====
    on run
    set rezult to my commun()
    if affiche then (*
    display the results *)
    tell application theApp to display dialog rezult
    else (*
    insert the results in the text body *)
    tell application "Pages" to tell document 1 to set selection to rezult
    end if
    end run
    --=====
    --[/SCRIPT]
    Yvan KOENIG (from FRANCE jeudi 19 février 2009 15:45:56)

  • Pages 08' Word Count?

    Is there a word count for Pages 08? If so, how do I see it or view it?

    PeterBreis0807 wrote:
    But Yvan I had to teach you how to do that.
    You had to teach me that quotes are required for Preview under 10.5 because I don't use 10.5 !
    In fact I don't use Preview because I prefer Adobe Reader which displays my docs a better way.
    here Preview under 10.5
    here Adobe Reader (10.4 and/or 10.5)
    More to the point is that if the Word Count function is in a logical location, why are so many unable to find it without resorting to searches of the manual?
    Because most of them doesn't search seriously.
    But, even it the location was odd, it's not normal that they ask here before searching in the Help AND in the PDF User Guide.
    The forum is not a catch all questions recipient.
    The Help and terms of use clearly urges them to search in the delivered resources.
    These resources are:
    (1) the menus themselves
    (2) the Inspectors themselves
    (3) the Help
    (4) the PDF User Guide which is delivered with every copy of iWork, on disk or in downloaded versions
    (5) last not least, in the existing threads.
    For my own use, I searched in the Help and in the PDF because I was surprised to read users claiming that they didn't found the info.
    Doing that, I discovered that what _I got in the Edit menu_ is also available in an Inspector in which I had never searched as I was already able to get the tool in the menu.
    When I searched in the Help I found nothing useful.
    When I searched in the PDF, as I am running 10.4, Preview and Adobe Reader gave the response instantaneously.
    You wrote here that under 10.5, Preview behaves differently.
    I checked and in my response I wrote that quotes may be required.
    Last not least, searching in the existing threads give also the response immediately.
    So, from my point of view, if we continue to read the question here it's only because many users think _"why would I make the effort to search by myself when there will be some one which will give the response on the forum"_ . In other words, lazyness is becoming the rule.
    Yvan KOENIG (from FRANCE mercredi 24 septembre 2008 17:28:05)

  • Is there a way to exclude title, heading and bibliography text from the word count in pages?

    I've just got the newest version of pages.
    The word count includes everything, from titles to endnotes - including the numbers in my sub-headings.
    I used to use open office where you could select a style i.e. 'body tex't, and get a word count that didn't include every single word in a document.
    Is there a way of doing something similar, or reseting the word count to only 'body text' so I know exactly how long my essays are?
    Thanks.

    Unfortunately, no version of Pages has this fine-grained control over document components and their word count, so the answer is no, regarding user changeable settings.
    Programmatically, I just told AppleScript to count the words of body text in a currently opened Pages v5.2 document. The count matched the Pages word count for the document. So, no solution there either.

  • Does anyone know why the word count in Word for Mac changes so drastically? In one document it goes up and down by several hundred at a time when I have done nothing but scroll through the document.

    I am new to the wonderful world of Mac and all of my documents were created in MS Word on my old laptop. I noticed that the word counts were slightly different when I opened the documents in Word for Mac, but then I noticed that they changed drastically. For intance, I opened a document today and after the initial period where the word count shifts, it seemed to settle on 13,171. I left the document for a while to work on some other things and when I came back the word count had changed to 11,677. I didn't do anything to the document. Word counts are important to me since I need at least 60,000 for my PhD Dissertation. Which word count should I trust?

    Since Word is a Microsoft product, you should probably post your question on the Microsoft Mac forums:
    http://answers.microsoft.com/en-us/mac

  • When converting a PDF document to word, the word count feature is not giving me the number of words

    I have been using Acrobat for converting PDF documents to Word.  It had been working just fine, but lately, when I convert a PDF document to Word, it is not giving me the word count, which is why I subscribed in the first place. Someone has any idea of why?

    Hi Robin,
    I would recommend you to use Acrobat software to convert this pdf file, Acrobat software enable you to customize the conversion settings.
    You can download a free 30-day trial from this Link : https://helpx.adobe.com/acrobat/kb/acrobat-downloads.html
    After downloading and installing acrobat, Open pdf file in Acrobat, go to File menu -> Click 'save as other' -> Microsoft Word -> Word Document.
    A pop-up window will appear that would prompt you to choose the file to be converted, after you select the file, click on the settings button on the bottom left of the pop-up window and choose 'Retain Page layout' under layout settings, click ok and then save.
    Hope that helps with your query.
    Regards,
    Rahul

  • Adobe Acrobat 9/Win7 - Inserting Word documents into PDF file intermittently leads to missing or garbled text?

    Heya.
    I have a user who is creating a PDF essentially compiled from inserting word documents into the position she wants inside of the PDF.
    The problem is that sometimes this leads to missing or garbled text. For example, 6-8.1 is displayed as 6- .1. Which is just plain weird.
    Other times, the text looks garbled or uneven. She turned off her PC but I took screenshots of both of these scenarios. I fear that I am not going to be able to retroactively fix the corruption in this document for her.
    She says she's using very standard fonts. Like Arial. I asked if she could locate the original Word document that produced the garbled text, just for a sanity check. The problem is that her co-worker may have been the only one with that particular word document (there are probably hundreds which compile this PDF...) and IF she has it, she might not be able to locate it on her PC TO check what the original text is. Yikes.
    Google-fu turns up very little. I tried the guidance in this document - https://answers.acrobatusers.com/We-combine-PDF-document-ends-corrupt-What-problem-q197619 .aspx[2] and a Save-As but no avail.
    This also turns up but is not applicable to Acrobat 9 I believe:  http://blogs.adobe.com/acrobatineducation/2010/02/get_rid_of_that_bloat_in_your.html[3]
    She states that she can manually fix the document but after a while it gets corrupted again? But I haven't observed that and she might have just fed me that to amplify the problem.
    I will be able to post screenshots when she turns on her computer tomorrow.

    Here are the two instances of corruption we have come across.
    http://imgur.com/nPztMYm
    http://imgur.com/wHM12e2
    Edit:  A LITTLE MORE INFO.  I am able to select the corrupted text, paste it into Notepad with all the characters intact.  So the characters are THERE.  they are just not being displayed correctly.
    Edit:  They also do not print correctly.  The page prints with characters missing, and she wants to print this document, so that is going to be an issue.

  • How do you get word count to print at the end of a document in Pages?

    How do you get word count to print at the end of a document in Pages?

    Pages v5 does not provide a user assignable word count variable. With some AppleScript, and a paste operation from the clipboard, you can have locale punctuated word count in this format: 7,803 — anywhere in your document. The following AppleScript works with Pages '09 v4.3 through Pages v5.5.2 on Yosemite.
    I would suggest that you copy paste the following AppleScript into your [Apple] Script Editor and save it (suggestion) wordcnt.applescript. Then, follow this with an option+Save As… and this time set the File format to Script Bundle, or Application with hidden extension — saved to your Desktop. Provided you have a Pages document open, you are then a double-click from the ability to paste your current word count into Pages.
    Note: If you have Pages word count display enabled, it will automatically count your pasted value as another word which initially may deceive on true word count at the time the script was run.
    AppleScript
    --- copy below this line ---
    property locale : "en_US.UTF-8" -- In Terminal, use the locale command to see yours
    if not ApplicationIsRunning("Pages") then
         display dialog "Pages must be running to use this utility."
         return quit
    end if
    tell application "Pages"
        tell body text of front document
            set wordCnt to count words
            -- Don't want punctuated numbers? Remove the single quote from printf format
            set the clipboard to (do shell script "export LC_ALL=" & locale & "; printf \"%'d\" " & wordCnt)
        end tell
    end tell
    on ApplicationIsRunning(appName)
         tell application "System Events" to set appNameIsRunning to exists (processes where name is appName)
         return appNameIsRunning
    end ApplicationIsRunning

  • Can you do a Word Count in Pages?

    I am working on College essays and applications and a lot of the essays they require you to write can only be so many words. Is there a way to do a word count on Pages? On my PC, Microsoft Word 07 automatically has the word count in the bottom of the window.
    Please help!

    In the inspector there is an automatic word count in the document section. All you need to do is select the info column and it should be there!
    John

  • Indesign CS6 Total Document Word Count... No?

    I left the following comment on a Youtube tutorial explaining how to execute a word count query for an Indesign document ASSUMING your article layout uses a single box of text:
    What if an article uses a creative layout with multiple text-boxes? Are you supposed to get out your pocket calculator and add them up one-by-one?
    I work for a magazine that publishes short, submission-style testimonials bridged together with staff-generated narrative copy; some of our articles use six or more discreet text-boxes. You REALLY MEAN TO TELL ME that there is NO WAY to yield a TOTAL DOCUMENT WORD COUNT using what is SUPPOSED TO BE the MOST ADVANCED page layout application ON EARTH??
    Pardon my exasperation in the above comment, but....Seriously?  
    I need someone knowledgeable to please look me in the eyes and tell me, "This is true", before I am going to be able to let myself believe it.
    Thank you.
    - Exasperated Journalist Slag

    Yes, there are ways, just not what you expected.
    One approach to counting words in multiple text frames in InDesign is to thread them together. To maintain the pieces of text in their assigned threaded text frames, you can create a paragraph style that starts in the next frame, and assign it to the first paragraph in each text frame. Or, you can break the threads when the count is stable.
    If the text frames need to adjust their size to the amount of their content, search Google for terms like "indesign auto resize text frame" without quotes for details.
    There was a recent discussion about auto-resizing text frames that mentioned the free AutoFit InDesign plug-in, from typefi.com. Search Google for terms like "indesign typefi autofit" for details.
    Search Google for terms like "threading and unthreading InDesign text frames" without quotes, for details.
    Search Google for terms like "indesign start paragraph in next frame" without quotes, for details.
    You can file a formal feature improvement request here: Wishform.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices
    evanexempt wrote:
    I left the following comment on a Youtube tutorial explaining how to execute a word count query for an Indesign document ASSUMING your article layout uses a single box of text:
    What if an article uses a creative layout with multiple text-boxes? Are you supposed to get out your pocket calculator and add them up one-by-one?
    I work for a magazine that publishes short, submission-style testimonials bridged together with staff-generated narrative copy; some of our articles use six or more discreet text-boxes. You REALLY MEAN TO TELL ME that there is NO WAY to yield a TOTAL DOCUMENT WORD COUNT using what is SUPPOSED TO BE the MOST ADVANCED page layout application ON EARTH??
    Pardon my exasperation in the above comment, but....Seriously?  
    I need someone knowledgeable to please look me in the eyes and tell me, "This is true", before I am going to be able to let myself believe it.
    Thank you.
    - Exasperated Journalist Slag

  • Word count and my ActionPerformed

    I am having a little trouble with my program and was wondering if anyone could spot the mistake... I am trying to make a simple application that will count the number of words in a text field via click of a button and display the results.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    public class WordCount extends JFrame implements ActionListener
    // added JTextPane, JScrollPane, JPanel JTextField, and JButton
        public static void main(String[] args)
         // layout
        public WordCount()
              super();
              Container cp = getContentPane();
              wordCount.setEditable(false);
              south.setLayout(new FlowLayout(FlowLayout.CENTER));
              south.add(jbtCount);
                   jbtCount.addActionListener (this);
              south.add(new JLabel("  Word Count: "));
              south.add(wordCount);
              cp.add(BorderLayout.CENTER,jsPane);
              cp.add(BorderLayout.SOUTH,south);
         public void actionPerformed(ActionEvent e)
              //if(e.getSource() == jbtCount)   // user clicks Count Words Button
              Object s = e.getSource();
             if ( s instanceof Button )
                  jtPane.setDocument(new DefaultStyledDocument() {
                        public void insertString(int offset, String str, AttributeSet as) throws BadLocationException
                           super.insertString(offset,str,as);
                           String text = jtPane.getText();
                           String[] tokens = text.split(" ");
                           wordCount.setText("" + countValid(tokens));
                         public void remove(int offset, int len) throws BadLocationException
                           super.remove(offset,len);
                           String text = jtPane.getText();
                           String[] tokens = text.split(" ");
                             wordCount.setText("" + countValid(tokens));
                  else{}
         } // end actionPerformed
         private int countValid(String[] tokens)
              int count = 0;
             for (int i = 0; i < tokens.length; i++)
                    if (tokens.trim().length() != 0)
              count++;
         return count;
    } // end public class WordCount

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.text.*;
    public class WordCount extends JFrame implements ActionListener
         JTextPane jtPane = new JTextPane();
         JScrollPane jsPane = new JScrollPane(jtPane);
         JPanel south = new JPanel();
         JTextField wordCount = new JTextField(20);
         JButton jbtCount = new JButton("Count Words");
        public static void main(String[] args)
              int width = 700;
              int height = 300;
               WordCount f = new WordCount();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             f.setSize(width, height);
             f.setTitle("Word Counter");
             f.setLocation(200, 200);
             f.setVisible(true);
        public WordCount()
              super();
              Container cp = getContentPane();
              wordCount.setEditable(false);
              south.setLayout(new FlowLayout(FlowLayout.CENTER));
              south.add(jbtCount);
                   jbtCount.addActionListener (this);
              south.add(new JLabel("  Word Count: "));
              south.add(wordCount);
              cp.add(BorderLayout.CENTER,jsPane);
              cp.add(BorderLayout.SOUTH,south);
         public void actionPerformed(ActionEvent e)
              //if(e.getSource() == jbtCount)   // user clicks Count Words Button
              Object s = e.getSource();
                  // *** process Button actions
            if ( s instanceof Button )
                  jtPane.setDocument(new DefaultStyledDocument() {
                        public void insertString(int offset, String str, AttributeSet as) throws BadLocationException
                           super.insertString(offset,str,as);
                           String text = jtPane.getText();
                           String[] tokens = text.split(" ");
                           wordCount.setText("" + countValid(tokens));
                         public void remove(int offset, int len) throws BadLocationException
                           super.remove(offset,len);
                           String text = jtPane.getText();
                           String[] tokens = text.split(" ");
                             wordCount.setText("" + countValid(tokens));
                  else{}
         }// end actionPerformed
         private int countValid(String[] tokens)
              int count = 0;
             for (int i = 0; i < tokens.length; i++)
                    if (tokens.trim().length() != 0)
              count++;
         return count;
    } // end public class WordCount

Maybe you are looking for

  • Loop at screen in CJR2 layouts (or KPP1L management ) ?

    Hi to all, I need to make as input fields (and consquently,  to disable as input fields at some other conditions) the layouts on CJR2 transaction . In my case it is available an include custom (as a standard modification ) in which I can use "loop at

  • Connecting 1st Gen i-pod to comp without firewire port

    Does anyone know any way to connect a first generation ipod to a windows computer without a firewire port? Because it is first generation the i-pod only has a firewire port on it and is not compatable with a dock connector. Is there any cable i can b

  • ORA-06550 in Apex 4.2

    We have upgraded to Apex 4.2 - we now intermittently get the following in the development GUI as well as our applications ORA-06550: line 1, column 17: PL/SQL: ORA-00936: missing expression ORA-06550: line 1, column 9: PL/SQL: SQL Statement ignored E

  • 8.1.7.2.2

    How do I get from 8.1.7 to 8.1.7.2.2 for Solaris 8? Is there uprgrade available to downloaD?

  • [SOLVED] Duplicity getting 'stuck' when attempting to restart a backup

    Hey all, After a backup attempt failed partway through (first-time full backup) with this error: AsyncScheduler: scheduling task for asynchronous execution No handlers could be found for logger "paramiko.transport" AsyncScheduler: a previously schedu