Results 1 to 2 of 2
  1. #1
    itsBenMason is offline Member
    Join Date
    Sep 2014
    Posts
    1
    Rep Power
    0

    Default JTables - Saving Loading

    ok so i'm new(ish) to Java programming and i have made a program that i can use in my work place to help me remember stuff and keep track of things i do, i have text fields one for customers and the other for what job file the work is in. it all works well when i press a button it puts the information i need right into the table (Lovely) but the problem is i don't know how to i can save table and make the same information load back into the table if i close the program one day and open it the next (Either automatically loads into the table when i open the program or by pressing a button to retrieve the information). i just cant save it or load it in other words :3 was hoping for some of you amazing people to help me out and give some guidance

    Thank you in advance.

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: JTables - Saving Loading

    It should be relatively easy since a JTable uses a table model to handle the data. The model is backed by some data structure
    to actually house the data. So you could write this information to a binary file, a text file, or even a properly tagged XML file.
    I would recommend some text file since it would be easier to repair if the data gets corrupted. If you want to preserve different
    formats and colors of the data, then more information would need to be stored, perhaps using XML attribute tags.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. problem with loading/saving hashmaps
    By S.Mason in forum New To Java
    Replies: 3
    Last Post: 07-08-2012, 03:53 AM
  2. saving / loading a file - TicTacToe
    By Herah in forum New To Java
    Replies: 0
    Last Post: 12-01-2011, 02:59 AM
  3. Saving from, and loading to an array.
    By VisionIncision in forum New To Java
    Replies: 4
    Last Post: 11-23-2010, 09:47 AM
  4. Saving and loading information
    By applewood13 in forum New To Java
    Replies: 1
    Last Post: 09-30-2010, 05:29 AM
  5. Replies: 0
    Last Post: 08-02-2010, 10:26 AM

Posting Permissions

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