Saving changes in App...

I have an app with a several JPanels. On each JPanel are several smaller JPanels that can be dragged around. Each time I start the app the draggable JPanels are located at the position they were coded in at (with the 'setBounds' method).
Each time the app is opened I need the JPanels to be at the location they were at when the app last closed.
Can someone please HELP??? thanks...

i tried writing out the X and Y coordinates of the JPanels and then reading them back in at startup but no matter where the JPanel is the coordinates are always written out as 0.
heres how I'm doing it...
frame.setDefaultCloseOperation(frame.DO_NOTHING_ON_CLOSE);
frame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
      writeoutbutton.doClick(); //button carrying out write action
writeoutbutton.addActionListener(new ActionListener() {
               public void actionPerformed(ActionEvent e) {
try{
int n = JOptionPane.showConfirmDialog(frame, "Save Changes Before Exiting?", "Save?", JOptionPane.YES_NO_CANCEL_OPTION);
if (n == JOptionPane.YES_OPTION) {
DataOutputStream out = new DataOutputStream(new FileOutputStream("file.dat"));
out.writeInt(jpanel.getX());  //same process for Y coordinate
out.flush();
out.close();
System.exit(0);
}else if (n == JOptionPane.NO_OPTION) {
          System.exit(0);
}else {}
}catch(Exception a){}
// then reading in at startup...
DataInputStream in = new DataInputStream(new FileInputStream("file.dat"));
jPanel.setLocation(in.readInt(), same process for Y coordinate);
}});everytime I run this and restart the app, the JPanel is at the 0,0 location of its container(it also prints 0 for the coordinate using... System.out.println(in.readInt());
help please??

Similar Messages

  • Stocks App not saving changes

    My stocks app is not saving changes no matter what changes I make.  After making a change, I'll exit the app, re-enter and it defaults back to a whole bunch of stuff I didn't add.
    Can someone help me with this, I'm not sure where to even start!

    Nadia Bielawa wrote:
    This did not help at all.  I'm not about to restore my iPhone and set everything up again, there must be a simpler solution. 
    Th simple solution is restart.
    If that fails,  thenreset.
    If that fails, then restore from backup.
    If that fails, then restore as new.
    If that fails then make an appointment at the genius bar.

  • Received 409 (Conflict) for saving changes in workspace crx.default

    When i creat a new jsp file and save the file  , i get the following error on CRXDE lite  :
    Could not save changes. Received 409 (Conflict) for saving changes in workspace crx.default. This node already exists: /content/TrainingSite/contentpage.jsp
    Can anybody please suggest the cause of the problem and the meaning of the code.
    Thanks

    Well that usually means that there is already a file/node with the same name so you can't create a new one at the same place. Are you sure there isn't already a node with that name? Perhaps created by someone else?
    Also it would be unusual to create a JSP under /content - normally all JSPs would be created under /apps/<myapp>/components/somecomponent/contentpage.jsp. Are you creating you JSP in the right place?

  • I live in Australia but when I upgraded to IOS6 it changed my App Store region to the US. How can I change it back? I have been trying to find the answer.

    I live in Australia but when I upgraded to IOS6 it changed my App Store region to the US. How can I change it back? I have been trying to find the answer.

    Contact iTunes support & request they clear the balance:
    http://www.apple.com/support/itunes/

  • How can I change the app store location?Want to buy in us and it keeps saying I'm in the australia app store

    How can I change a app store location? I'm in US trying to dowload an app and it says my account is not valid in the Australian store. I have nothing to do with Australia.

    Go to the iTunes Store. Scroll down to the very bottom and click the flag that is on the bottom right. Then you can select what store you want.

  • Close Excel com object without saving changes?

    Hi, I am trying to write a script which opens each of 31 excel workbooks, retrieves a value from a cell, and closes each workbook after retrieving.
    My code so far:
    $day=1
    $excel = New-Object -ComObject Excel.Application
    $excel.Visible=$True
    $workbook= $excel.Workbooks.Open("C:\Path|to\File\1_"+$day+"_14.xlsx")
    $workbook.sheets.item(1).activate()
    $WorkbookTotal=$workbook.Worksheets.item(1)
    $value = $WorkbookTotal.Cells.Item(7,13)
    $value.Text #this should give you back the Value in that Cell
    $excel.close()
    My problem is that when the code hits the $excel.close() method, the file stays open, and prompts for saving changes.  I don't know why it thinks there are changes, but what I want is to close the workbook without saving changes.
    I've just closed 44 open browser tabs, and have tried many things over the last hour, but can't seem to get this one.
    If anyone has any advice on how to do this, it would be greatly appreciated!
    Thanks,
    Kevin

    Hi,
    Please replace below code:
    $excel.close()
    with
    $workbook.close($false)
    $excel.quit()
    Hope this helps.
    Regards,
    Yan Li
    Regards, Yan Li

  • Can I change my apps from one Developer account to another?

    I am 15 years old, so I can't have an developer accont, for now, I'll use my father's to post my own apps, but my question is, when I turn 18, I'll be avaliable to change the apps that I posted on my father's account with his name to my new account with my name?
    Thanks!

    No. Apps are associated with Apple ID with which they were purchased.

  • How can I change an app's Apple ID from one that no longer exist to a current one?

    how can I change an app's Apple ID from one that no longer exist to a current one?

    vanesanesa wrote:
    how can I change an app's Apple ID from one that no longer exist to a current one?
    Apple IDs generally don't stop existing. If you mean that you have changed your email address, what you need to do is update your Apple ID to the new email.  Start here:
    https://www.apple.com/support/appleid/manage/

  • How can i change my app store from UK to TURKISH?

    how can i change   my appstore from UK to TURKISH?

    How to Change Your App Store Account Location | eHow.com
    Note you can only purchases items from the iTunes/Apps store from the country's store in which you are located and your payment method and account must be associated with the country.

  • How can i change My app store from USA To Sweden?

    How can i change My app store from USA To Sweden?

    If you are getting an 'account not in this country' message then try going to the bottom of the Featured tab in the App Store app on your iPad and tap on your account id, tap on 'View Apple ID' on the popup and log into your account, and then select the Country/Region section and select Sweden.

  • How can i change my app store from us to uk?

    how can  i  change my app store from us to uk?

    Hello Emilaine
    To change countries of the iTunes Store, go to Settings > iTunes & App Stores > Apple ID: > View Apple ID > Country/Region. From there it is a matter of picking the U.K. Store and you should be good.
    iOS: Changing the signed-in iTunes Store Apple ID account
    http://support.apple.com/kb/ht1311
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • How can i change my App Store : us to french? Modified by error...

    How can i change my App Store : us to french? Modified by error...
    My original store has been changed while downlaoding apps.
    I can't update m'y apps bécasse i'm not on the well store.
    How CAN i find original store.
    Thanks.

    Welcome to the Apple Support Communities
    See "Change your iTunes Store country" > http://support.apple.com/kb/HT1311

  • I already have changed my apple id. But whenever I update any application, it is asking and using the old app id and password that is not a working e-mail already. How can I change my app id?

    I already have changed my apple id. But whenever I update any application, it is asking the old app id and password that is not a working e-mail already. How can I change my app id?

    So you made a new Apple ID? Unfortunately that won't work. Content is forever tied to the Apple ID that bought it. Apple does not transfer content from one ID to another and Apple does not merge Apple IDs. What should have been doen is mearely change the email address that was associated with the Apple ID.
    http://support.apple.com/kb/HT5621
    The only way that you can do this now is with a new email address if you used your current email address for the new Apple ID.

  • Error message: "Querying or saving changes to the database failed."

    Hi all,
    I can sense I'm becoming a regular on this particular forum - the problem of spending 8 hours a day trying to get this software working!
    _*The problem*_
    When i try and setup a new device, or modify an existing one, I get an error message when i get to the Transcode Settings page. The error message is "Querying or saving changes to the database failed." After this I get a blank screen and can no longer see my settings.
    No amount of restarting has fixed this. And I cannot see a way to create a device through the client software and add transcode settings.
    Help?
    Thanks in advance,
    Ben

    Ah very good!
    Ok - it seems then that this works absolutely fine as a work around. I can create a device and then assign the device to transcode settings through the client adminsitration panel (which is indeed what I meant).
    So, there is a work around. Far less pressing now, but I would like to know why I'm getting the error message all the same - I'm now concerned about the integrity of the database...
    Thanks Tony!
    B

  • My username (email address) has changed. Apps that I purchased with the old username ca not be updated as the password from the old username no longer works and apple can not send me info to an addres that no longer exists. What can I do?

    My username (email address) has changed. Apps that I purchased with the old username ca not be updated as the password from the old username no longer works and apple can not send me info to an addres that no longer exists. What can I do?

    Try here...
    Frequently Asked Questions About Apple ID

Maybe you are looking for