Don't know how to change the position, I do know how to save the position for later, let's say it's an int. you can save it to a file like this:
import java.io.*;
import java.nio.channels.*;
public class createFile
{
File file = new File("Hej.xml");
public void deleteAndCreate()
{
boolean success = file.delete();
if(success)
{
new createFile();
}
else if (!success) {
try {
// Create file if it does not exist
boolean successer = file.createNewFile();
if (successer) {
// File did not exist and was created
try {
BufferedWriter out = new BufferedWriter(new FileWriter(file));
out.write(theInt);
out.close();
} catch (IOException e) {
}
} else {
// File already exists
}
} catch (IOException e) {
}
}
}
public createFile()
{
deleteAndCreate();
}
public static void main(String[] args)
{
new createFile();
}
}