Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Search and delete data to a Text file in GUI

  1. #1
    Junior Member
    Join Date
    Aug 2013
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Search and delete data to a Text file in GUI

    Hi there!!! I'm a beginner in java programming and i need some help for doing this program.
    The problem is making a file manipulation in GUI where u can add, search and delete to a text file. I'm actually done with adding data to a text file, my problem is how i can delete and search data to a text file. thank you for those who are willing to help me


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Search and delete data to a Text file in GUI

    Since random access to data stored in a file is not easy or practical, one typically works on the data, in this case text, in memory. Load the data from the text file into memory and search the data, deleting, modifying etc. as needed. When done, write the result back to the file.

  3. The Following User Says Thank You to GregBrannon For This Useful Post:

    Nathanlll (August 24th, 2013)

  4. #3
    Member
    Join Date
    Jul 2013
    Posts
    219
    Thanks
    0
    Thanked 18 Times in 17 Posts

    Default Re: Search and delete data to a Text file in GUI

    Hello.
    Use JTextArea on your GUI component. Whenever you open/work with a file load the file contents into this text area.
    Add TextListener to the text area. Whenever the text changed event takes place copy the contents back to the original file.

    Coming to search, GregBrannon already gave the idea. Just cache the file contents and search.

    Syed.

  5. The Following User Says Thank You to syedbhai For This Useful Post:

    Nathanlll (August 24th, 2013)

Similar Threads

  1. Replies: 1
    Last Post: May 18th, 2013, 11:28 PM
  2. Replies: 8
    Last Post: December 4th, 2012, 04:58 AM
  3. search string in a text file
    By dewet in forum Android Development
    Replies: 2
    Last Post: April 10th, 2012, 02:39 PM
  4. Replies: 8
    Last Post: March 25th, 2011, 02:34 PM
  5. How to delete data from php through GUI in Java?
    By BluXit in forum What's Wrong With My Code?
    Replies: 3
    Last Post: May 26th, 2010, 09:41 AM