Results 1 to 3 of 3

Thread: Searching issue

  1. #1
    RKhadder is offline Member
    Join Date
    Sep 2010
    Posts
    7
    Rep Power
    0

    Default Refreshing JTextArea

    I made a program to search a file for me, however I do not know how to show the findings. The current set up is

    [JTextField][Search Button]
    [

    JTextArea


    ]

    Is there a way to make the data show up in the JTextArea without having to show the whole entire document which consists of over a million lines?

    Thanks
    Last edited by RKhadder; 01-28-2011 at 02:24 PM.

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    You don't say what the program is producing as a result of its search. Supposing that the document is text and you are getting an character index of the start of the match you could extract a portion of the document and display that.

    For instance if the text were natural language you could search back and forwards from the match location to locate '.' and display the sentence containing the match. Or you could display the entire line on which the match occurs along with the line number. (If the file is big and you are searching line by line then this latter approach would seem the most natural.) Or there might be some location information embedded in the document itself (like chapter/section/subsection numbers) and you might display the appropriate subsection.

    All sorts of display options are possible. Basically you should decide what you want the specifications of your text area to be - what makes sense for your application. And write the code for that.

  3. #3
    hosscomp is offline Member
    Join Date
    Oct 2010
    Posts
    63
    Rep Power
    0

    Default

    Is there a way to make the data show up in the JTextArea without having to show the whole entire document which consists of over a million lines?
    Yes. Call myTextArea.append(finding) where finding is the next String you want to show.

    Look up the methods for JTextArea.

Similar Threads

  1. Searching
    By peliukasss in forum Lucene
    Replies: 0
    Last Post: 04-07-2010, 02:05 AM
  2. Searching in several fields
    By ivaneggel in forum Lucene
    Replies: 0
    Last Post: 11-11-2009, 10:24 AM
  3. Searching Arrays
    By BHCluster in forum New To Java
    Replies: 3
    Last Post: 07-26-2008, 06:55 AM
  4. searching within a JList
    By newtojava7 in forum New To Java
    Replies: 1
    Last Post: 03-10-2008, 01:12 AM
  5. searching
    By nalinda in forum New To Java
    Replies: 3
    Last Post: 12-06-2007, 03:56 AM

Tags for this Thread

Posting Permissions

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