Results 1 to 3 of 3
  1. #1
    jurka is offline Member
    Join Date
    Jul 2008
    Posts
    67
    Rep Power
    0

    Default Stuck at storing settings for Swing app

    I have made a simple settings frame and i used atm the Pref API to store data. But the problem is that it requires every time when i am getting the data to initialize the default value(that's why i dont like it). So i thought to make my own Pref API class where it loads the default data from text file ? But it seems for me to messy to use this API like so. What you think any alternatives ?

  2. #2
    Jeremy is offline Member
    Join Date
    Jul 2008
    Posts
    28
    Rep Power
    0

    Default

    Would a database (like SQLite) be overkill? Maybe try using an XML document.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,792
    Rep Power
    25

    Default

    Could you give an example? Show what you are doing and explain the problem.
    Preferences requires a default value in the case that there is no value to be returned. It there is a value, you get it.
    String aPref = prefs.get("Key", "default");
    This will return what is stored in prefs if present, otherwise it returns "default".
    Do you want to change the default every time you run the program? If so, please expain why?

Similar Threads

  1. JVm Heap memory settings
    By nagesh in forum Advanced Java
    Replies: 2
    Last Post: 09-17-2009, 06:47 PM
  2. Storing data permanently
    By shaungoater in forum New To Java
    Replies: 2
    Last Post: 03-10-2008, 05:18 PM
  3. JVM Heap memory settings
    By nagesh in forum New To Java
    Replies: 1
    Last Post: 08-11-2007, 11:17 PM
  4. Storing Data
    By Khorod in forum New To Java
    Replies: 1
    Last Post: 08-03-2007, 06:48 AM
  5. Detecting Browser Settings
    By arupranjans in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 07-31-2007, 03:31 PM

Posting Permissions

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