Re: How to save user inputs?
On Aug 17, 10:11 pm, sale31...@yahoo.com wrote:
- This 'GUI' is it an applet or frame?
I'm using frame.
- If the latter, do you intend to launch it using webstart?
For now I'm launching it within Eclipse, for later i haven't think
about it. I'm just experimenting with layout managers and components.
Ahh.. here is where it becomes tricky.
If you want to deploy it (ultimately) using webstart,
there are 'security considerations' to writing files
(or otherwise accessing the local file system).
Either the application needs to be digitally signed,
and all-permissions, OR you might look to use the
PersistenceService (PS) API that is *only available*
to webstart launched apps.
If using the PS API, the storing and retrieval of the
saved settings or program configurations (OK, now
I check it was 'text inputs') would need to be designed
Here is an example of the PS..
For a 'plain old app.' (much harder to install, for
the end user) or a signed and all-permissions webstart
launched app., the options are wide.
Save the settings where, and in what form best suits.
- I suggest a sub-dir of user.home, more details here..
- What is the minimum version of Java that your app.
is aimed at?
If you mean JDK, it's 1.5
Yep, I did (kind of), and 1.5+ is good.
Most options (I can think of) are in the mix.
- You might serialize plain old java objects that
represent what you want to store(/retrieve) but
that is unreliable across upgrades.
- Properties files are good for storing key/value pairs.
Get one of those using java.util.Properties
- Since 1.4, Java can read and write XML, a better
way to store more complicated data than a Properties
file is suited to.
- ..there is at least one other 'standard' way to
store config. data, but I always forget what it is
..and this time is no different.
You gave me link to Lesson: Basic I/O. Are you suggesting to write
data to some file?
I sure am. It is about the only way I can think
of, to store data between application runs (unless
you intend to store it on a remote server, which
BTW - did I mention that 'persistence' in Java
(and probably most languages) is complicated? ;-)