Reset windowing system in NetBeans Platform
One of the benefits of building programs on top of NetBeans Platform is the powerful windowing and docking framework it provides out of the box. Part of this functionality is persistence; when a user closes a NetBeans Platform application, the state of all the windows is saved. The next time the application is started, the windowing state is restored. This is why the NetBeans IDE (which is built on the NetBeans Platform) remembers which files you had loaded and how you had your windows arranged.
During development, it is sometimes beneficial to do a ‘factory reset’ and reset the windows back to the way they would look when the application is launched for the first time. For instance, you may have inadvertently closed some windows you wanted to have open, or you opened some windows that you wanted closed and don’t feel like manually restoring each window’s open/closed state. Or perhaps you moved some of the windows in a position that made sense for testing part of the application, but now you want to test another part that requires the original windowing setup.
Clean and build
There are two main ways to do this. The easiest way is to do a full clean and build of the project (right click on the top level project node in NetBeans and choose Clean and build)
This works fine, but it has the drawback of.. cleaning and rebuilding the project. This can take a long time for complex projects, and is a bit overkill if all you want to do is reset the windowing system.
The second way of accomplishing this is to remove a folder named “Windows2Local”. If the root of your NetBeans Platform project is located at /path/to/Foo, then the folder to remove is /path/to/Foo/build/testuserdir/config/Windows2Local
You can delete the folder any way you see fit; I usually do a
rm -rf /path/to/Foo/build/testuserdir/config/Windows2Local
from the terminal.
This folder contains the saved information about the window placement and sizes; by removing it, you force NetBeans to recreate it when the application restarts.
This method is much faster, as nothing needs to be recompiled. It is my preferred way of resetting the windowing system back to its default state when developing NetBeans Platform applications.