Remembering the size and location of a frame

I would like my application to remember the location and size of the frame when closted and restarted.
First I thought that I simply could store the settings in a file on close, and on startup restore those values.
But then what if the user maximizes the frame? The those settings would either be the same as when started or the maximum size, so theres no way to remember the latest size in Frame.NORMAL state.
So I was wondering how you guys solve this? Is there a listener I could use to catch some window rezise event with?
Best regards
S�ren

There are a couple listeners you could use on your JFrame:
1. ComponentListener's componentResized event will be invoked after the JFrame's size is changed.
You could examine the state to see if it's NORMAL (not iconified or maximized) and store the latest
normalized size, to be saved at application shutdown.
2. WindowStateListener: this is called after the state changes, and I've noticed that calling the JFrame's
getWidth and getHeight methods here sometimes returns the new dimension, sometimes the old!
Option 1 seems an all-around better choice.
Also, if you're saving state in a file -- check out java.util.prefs -- it rocks and it's easier than file i/o!

Similar Messages

  • What Preferences Control Window Size and Location?

    I have a number of windows that over time have taken on weird sizes and locations. For example, a print window habitually shows up with the print button underneath the dock, forcing me to move the window to click on the options.
    Is there a preference I can trash--or anything else I can do--to return the sizes and locations of windows to something resembling normal?

    That's done by each individual application.
    Many will remember where the window last was, and re-open it in the same place & size.
    Find the preference file for the app in question (probably in <your home folder>/Library/Preferences folder), quit the app, rename the file (append "old") to the end, and start the app again.
    The window should open in a default location; move/and or resize it, close the app and open it again. If that fixes the problem, trash the "old" file and re-enter any other preferences.
    If it doesn't fix it, you've probably got the wrong file. Close the app. If there's a new version of the file you renamed, delete it. Remove the "old" from the previous one.

  • How can I get Lync 2013 to "remember" the size of my conversation window

    Each time I open a Lync conversation, the window size always reverts to a default that is too small.  With Lync 2010, a new conversation remembered the size of the window from a previous conversation.  How can I get Lync 2013 to remember the
    size from a previous conversation?  I have a multi-monitor setup and would also like for Lync to remember the location of the last conversation window.  Lync 2010 remembered both the size and location.  I have Lync 2013 and Windows 7.

    I believe what you're seeing is expected behaviour. The Lync 2013 client appears to remember the position of the conversation window relative to the Lync client itself. It seems like it is noting it's screen co-ordinates based on the clients location. This
    works fine for single monitor, but ultimately means that a conversation window cannot remember it' location if it is on a different screen to the Lync client itself.
    Regarding the window size - I believe this has come up before and is not something you can change either natively in Lync, or through registry manipulation.
    Kind regards
    Ben
    Note: If you find a post informative, please mark it so using the arrow to the left. If it answers a question you've asked, please mark the thread as answered to aid others when they're looking for solutions to similar problems or queries.

  • Set size and location of  a component

    Hello,
    Does anyone familiar with this org.netbeans.lib.awtexttra.AbsoluteConstraints(). I want to set the size and location of the component, and I know this org netbeans can provide this function.
    getContentPane().add(chkTausta, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 120, -1, -1));
    chkRakkennus.setSelected(true);
    chkRakkennus.setText("Rakennukset");
    then it comes an error that org.netbeans.lib.awtextra.AbsoluteConstraints()cannot be resolved. Does anyone know what�s the reason. Do I have to download other version of Java. I have Jre1.6.0?
    Does anybody knows is there another way to set size of component. For example, if I use borderlayout, and put a button to the west, then how can I set the location and size of the button?
    Thanks a lot for you help.
    Clare

    org.netbeans.lib.awtextra.AbsoluteConstraints isn't part of the JDK. I suggest you don't use that at all. Let a LayoutManager do the resizing.
    Have a look at the [Layout tutorial|http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html] especially gridBagLayout

  • Finder window size and location not remembered

    I have OS X 10.10 installed.
    When I press Cmd/shift/H to open a finder window showing my home folder I get the default location and size for the window.  I resize and relocated the window and close it.  When I press that key combination again, the window is now showing the new size and location I previous set.  Unfortunately, when I restart the computer, this modification is lost and when I press that key combination the window opens with the default size and location.
    I have used the key combination of Cmd/Shift/A to open a finder window showing Applications and Cmd/Shift/U to open a finder window showing the Utilities folder.  I have been successful in resizing and relocating these windows, and having the system remember my modifications after a restart.  It appears to only be the Cmd/Shift/H combination that is faulty.
    Any ideas how to fix this problem?

    Paddster7,
    You could try trashing the hidden file inside the folder that stores some of its positioning and size settings.
    To show your hidden files.
    Launch ( Terminal ) -> Paste in the following ( defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder ) -> Press Return.
    Open the ( Offending Folder ) -> Delete ( .DS_Store ) -> Restart -> Move folder how you want to to stay -> Restart -> Did it stay?
    To reverse your hidden files back to hidden.
    Launch ( Terminal ) -> Paste in the following ( defaults write com.apple.finder AppleShowAllFiles -boolean false ; killall Finder ) -> Press Return.
    Supporting Articles
    http://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/
    http://en.wikipedia.org/wiki/.DS_Store
    Hope that helps,
    Weston

  • Remember size and location when opening saved document (CS5)

    Greetings,
    It would be nice to have a preference to remember screen rendered document size and location when saved, then the document opens at the last used size and location; I now reposition and resize every time I open my documents, which is often.
    Perhaps this feature has not been forgotten or omitted, maybe I just haven't found it yet?
    Garrett

    "I now reposition and resize every time I open my documents, which is often."
    Yeah, you said it... Which means that 100 times a day I curse Adobe for not including such a basic, fundamental capability.
    It's hard to believe that they do any testing by real users at all... How could they have missed this? And why haven't they immediately fixed it in a point update?

  • How to extract the size and date from a given file

    Hi,
    I want to extract the size and date of a file (it can be either a video, audio or text file) that the user points to the location of. But I am not sure how. Does Java have an api that can do this? If not is there some other way of doing this? Can anyone help? Thanks in advance.

    Have a look at java.io.File, specifically
    public long lastModified()
    This format returned (I find) is nasty, so then use java.util.Date (or java.sql.Date, look the same on the surface to me) to format it.
    Cheers,
    Radish21

  • How to set the size and position of JFrame

    hey all,
    i have a frame and i devide the frame into three panels, i want to make the top panel the lergest and make it square. and the rest two panels in small and in the bottom of the frame.
    could you please help me to set the size and position of the jpanel
    Thanks

    If u want the bottom 2 panels to be on the same level, u can try setting ur content pane to use the BorderLayout and the adding the 3 panels to it with BorderLayout.NORTH(for the TOP panel), BorderLayout.EAST(RIGHT panel) and BorderLayout.WEST(for LEFT panel).
    Don't know if this is what ur looking for, maybe u could describe more on ur layout with a sample image or something?

  • Camera Raw cache size and location

    I've been using ACR for about 3 years now, and today it occurred to me that I'm not that sure I know what the cache is actually used for. I mean, I know what a cache is, but what is ACR caching, and why?
    I use Bridge for most of my photo work, displaying high quality thumbnails and previews, often full-screen ("monitor-sized previews" by default). Bridge has its own cache, which I understand contains jpegs of thumbnails, previews, and 100% views. Does ACR's cache have any bearing on Bridge's behaviour and performance, especially with thousands of raw images?
    What sort of size and location of ACR cache should I be using - what factors do I need to consider?

    Hi,
    I'm still not sure what size of cache I should use, and what are the advantages and disadvantages of bigger or smaller ACR caches.
    Maybe Eric can tell something indeep about the impact of a large cache.  I'm not sure about that myself, but don't believe a larger cache is a real disadvantage, as long the disk on which it reside is maintained: defrag often). Since Bridge and ACR work hand in hand here, it might depend to your workflow and to your hardware. Sorry, I can't give a clear answer here.
    As said I would put it just large enough for a certain number of RAW or some weeks work. Means, when there is a chance I'ld touch a certain RAW in six weeks again, than six weeks * x images per day I shoot.
    Not sure if you are a Pro. I'm not and usually have not much new images every month.  I always was fine with the default settings.
    I don't work with Bridge and open one RAW after another in ACR, or maybe 20+ in a row when doing panorama ;-)
    But Bridge has to do a lot of work on the fly when it generates the previews for all new RAW in a folder, like: "read the image from HDD", "process it by ACR, "write Bridge previews and metadata to HDD", "write to ACR cache " - not necessarily in this order.
    And it seems it does this and some additional steps always (not only when first time reading RAW), because it f.e. needs to check if there are already processing information in ACR database or XMP file for a RAW or if they have been created in "meantime". Means ACR settings could have be changed after Bridge did a first time generation of the cache data, maybe because the RAW was openene directly via PS or by another app.
    this process is fairly processor-dependent, especially now that ACR uses more sophisticated processing in version 6, and, depending on ACR defaults, this can be significantly slower than in previous versions.
    And Bridges eats huge amount of memory as well - seems it holds a lot of information in memory before flushing it to disk.
    After reading this post of yours I made a test with my 12k RAW the other day. I tried to let Bridge create previews for all of them in one step, but it ended up complaining that there is not enough memory after ~ half an hour.
    Bridge appears to generate previews unnecessarily sometimes, because every image is already cached.
    See above. Bridge/ACR checks for updated processing information in XMP or ACR database and metadata updates. If it find some it might need to rebuild its cached image.
    Why would I need to reset the cache with a new monitor profile? Surely this is not applied to cache JPEGs?
    You are right, sorry I mixed things up here :-(  I meant ACR camera profiles. Aside that I changed monitor profile a lot over the last weeks doing some tests, and after that Bridge often refused to start until the cache was purged…
    Your suggestion of a larger cluster size is very interesting, and I may try this when I have some spare time.
    All my disks meant for storing large files (images, music, scratch, temp-file) are formated with a larger cluster size. It speeds things up a bit.
    Supposedly Lightroom's catalogue system is superior, but I am yet to be convinced that putting all my XMP data in one basket is a good idea.
    Of course LR shares ACR's cache. I don't know much about LR, but I believe XMP are not only kept in one basket here, right? They are written to the images and in case of RAW to XMP files. Otherwise there wouldn't be an interoperability between LR and Bridge. Similar to Bridge LR stores previews in it own "cache" which is as well a folder and file based "database". Check "preferences".
    But as said I use another DAM, in which’s database all data needed for searching is kept, but I also write all metadata (IPTC,XMP) to the images, even for RAW files. By this I don't need a large ACR cache and also don't have XMP files around, which I hate. When saying database, I mean a real database, not a collection of files which are kept on disk. ;-)
    Aside other advantages, I can take my database with me on vacations and can work on my images like I do at home. I have all my keywords and categories with me in one file and when back, I just copy the database to my desktop.

  • How to make Nokia Suite remember the position and ...

    how to make Nokia Suite remember the position and the size i set it?
    because everytime i start it, it defaults in the middle of the screen and in the smallest possible size.
    Nokia Suite 3.3.86
    Windows Vista
    Greece Nokia X6 RM-559 v40.0.002

    Again, are you talking about genuine Nokia firmware, not any of some 3rd-party customised versions?
    For officially released firmware, you may force Nokia Suite to reinstall even if your firmware is already up to date. This feature might be missed in its GUI as its link is "hidden" in the prompt message, not on a button or highlighted with underscore. Try Nokia Suite, once the phone is connected, click the icon of Software Update on the top, then click the word "reinstall" in the prompted message.
    bbao
    * If this post helped you, please click the white Kudo star.
    * If this post has solved your issue, please click Accept as Solution.

  • Default size and location, dialog boxes

    how can I set default size and location of dialog boxes? I have tried several things to no avail,
    thanks in advance

    1. You could create your own subclass of Dialog/JDialog with your defaults set automatically
    2. You could create a DialogFactory that creates Dialogs (pretty much the same as 1)

  • Opening Multiple Folders (Sizes and Locations)

    In selecting multiple folders and opening them all, is there a setting available or something a person manually does to when you open the folders they all open with the same size window and/or pattern? When I open multiple folders up they open up in random sizes and locations on my desktop.

    There's no built in way of doing what you want. You might give Default Folder X a try.  I've not used it so don't know if it will do what you want.  You may have to write an Applescript to do what you want.

  • How can I buy songs on my account if it's asking me the security questions and I don't remember the answers and I do not have a rescue email?

    How can I but songs on my iTunes account if it is asking me the security questions and I don't remember the answers and I don't have a rescue email?

    And I cannot call.

  • I can't change the email on my iCloud account on my iPhone because I can't remember the password, and I can't remember one of the security questions. What do I do?

    I can't change the email on my iCloud account on my iPhone because I can't remember the password, and I can't remember one of the security questions. What do I do?

    Hi karen615,
    Welcome to the Apple Support Communities!
    If you cannot reset your Apple ID password via security questions, you can reset via email authentication. If you are not receiving the email, it may be necessary to contact Apple Support using the link in the Get help section toward the bottom of the article. 
    If you forgot your Apple ID password - Apple Support
    Best regards,
    Joe

  • Help apple help me, at first I was new to iphone registration 1 apple ID account but because I hardly use icloud account. so I do not remember the password and login name, my computer crash when I decided to run the software on ios7.1, but do not expect m

    help apple help me, at first I was new to iphone registration 1 apple ID account but because I hardly use icloud account. so I do not remember the password and login name, my computer crash when I decided to run the software on ios7.1, but do not expect me to be locked iclou account, I hope this mail unlocked apple for my apple account. I'm currently using the machine iphone 5, IME: ********. thank you ... ask yourself? machine is in warranty period warranty icloud error not send mail to me at mail
    <Personal Information Edited by Host>

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

Maybe you are looking for