aspose file tools*
The moose likes Beginning Java and the fly likes loading past information Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "loading past information" Watch "loading past information" New topic
Author

loading past information

jake bellhorn
Greenhorn

Joined: May 03, 2006
Posts: 24
whats the turtorial on loading previous information. what i mean for the hockey pool is if the person already has a league setup they click the button "resume" or something then itll just load the information from it. so that they dont have to start a new league everyday
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Basically, the data needs to be stored somewhere outside of the JVM -- for example, on a hard drive. So the question becomes one of using Java I/O.

How exactly you go about doing this -- how complicated you make it -- depends on your application. It could be anything from a simple text file on the hard drive to serializing Java objects across a network.

I suggest starting with a text file. See the I/O section of the Java Tutorial or the I/O chapter of Thinking in Java.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
jake bellhorn
Greenhorn

Joined: May 03, 2006
Posts: 24
ive already done a text file i just need to noe how to load things
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by jake bellhorn:
ive already done a text file i just need to noe how to load things

The above links on I/O topics will help you with that. Give it a try, and let us know if you run into specific problems.
jake bellhorn
Greenhorn

Joined: May 03, 2006
Posts: 24


is there any easier way of putting this code into this one code (below) so that the player makes the league then it when he closes the program he can come back to it and will load that file


thats all i have and ive got 2 weeks to finish this project. thanks for helping me with this so far
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39396
    
  28
Are you getting confused between where you are reading from?

You can read from a file. The simplest way to read a text file is to use the java.util.Scanner class (J5.0 only) which is very basic, but works nicely.

You can read from a JTextArea. Look up its method particularly those that look like getText().

Look up the constructor for FileWriter and see what happens if you put true after the file name.

BTW: If you are printing out an Exception message, it is usually done via the System.err PrintStream rather than System.out.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: loading past information