How Can I Replace the Window Manager?
Perhaps your users are a bit confused by the ability to close, slide or dock windows or maybe you're trying to retain the behavior of some existing application's window system. There are times, however rare, in which you want to replace the typical NetBeans Window Manager org.netbeans.core.windows.WindowManagerImpl with a different one.
Before doing this you should know that starting with NetBeans 6.5, it will be easy to change certain behaviors of the window system. So needing to replace the window manager is rare already and will be needed even less often in the future.
But if you still want to do it, you can:
- Create an implementation of the org.openide.windows.WindowManager interface
- Register your implementation into the default lookup and replace any others
Of course, there's a lot of work involved in creating your own WindowManager implementation, but you can have a look at the org.openide.windows.DummyWindowManager class for starters. It's a simple implementation that opens all TopComponents in their own frame but which can also make windows invisible which is handy for testing.
The DummyWindowManager is used as a last resort when no other window manager is present; you will not need to register it in the default Lookup as described earlier. If you want to use it, keep in mind these two tips:
- Do not include the Core - Windows or Core modules in your application. Including Core will result in an error message from the NonGui class because it seems to expect an implementation of the NbTopManager.WindowManager class which you cannot (easily) provide.
- No windows will be shown by default on startup. Use a ModuleInstall class' restored() method to display your TopComponent.