Results 1 to 3 of 3
  1. #1
    Moorag is offline Member
    Join Date
    Mar 2011
    Location
    Cardiff
    Posts
    3
    Rep Power
    0

    Default Question about Dialog windows and files

    Hi guys,

    making a program that presents a GUI menu to the user which gives options to add or delete records of books from a library. Each button opens up a corresponding Dialog window where they enter details and click submit which then saves the details to an external file.

    my question is quite general - My constructor for the main menu Frame reads the records from the file and stores them in an ArrayList as soon as the program is loaded, then when a dialog window is opened i have a save button which invokes a method which adds the details to the ArrayList, saves the details to the file, closes the file and closes the dialog window. Is the file now closed permanently to the program, or does closing the dialog window kind of refresh or reload the main menu frame so that the file would be open again?

    Im thinking if the first option is true it doesn't make sense to read the file in the constructor for the main menu - I may as well only load it when one of the dialog windows is called.

    Any Ideas?

    Cheers :)

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Depends on how you implement.

    Say you are doing write to file periodically, then opening and closing file rises performance issues. If not best thing have to do is, open the file do the stuff write into it and close.

    If you could show us what you've done so far we can comment easily.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Similar Threads

  1. Parsing lnk files in windows
    By raysod in forum Advanced Java
    Replies: 2
    Last Post: 11-05-2010, 06:39 PM
  2. 2 Part question about cfg xml and dat files
    By Samgetsmoney in forum New To Java
    Replies: 0
    Last Post: 02-18-2009, 02:36 AM
  3. Replies: 2
    Last Post: 11-22-2008, 05:30 AM
  4. [SOLVED] JOptionPaneMessage dialog question
    By blueyan in forum New To Java
    Replies: 2
    Last Post: 09-28-2008, 07:50 AM
  5. Opeing multiple pdf files in different acrobat reader windows
    By shweta.ahuja in forum Web Frameworks
    Replies: 2
    Last Post: 05-07-2008, 12:33 PM

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
  •