Geertjan's Blog

  • June 16, 2008

Limiting the NetBeans Window System in NetBeans Platform 6.5

Geertjan Wielenga
Product Manager
If you're building your application on top of NetBeans Platform 6.5 M1 and above (or, since M1 isn't released yet, just get the very latest development build from netbeans.org), you'll be able to limit your window system's functionality. Your application's window system comes straight from the NetBeans Platform, but you've never been able to tweak it much. That's been something several people have asked for. They want to, for example, create a fixed layout for their application's user interface. Therefore, they don't want the end user to move the windows around (and/or to undock them, slide them into the sides of the application, etc).

Until a few days ago, there were several nasty hacks you could make use of in this situation. In the most extreme case, you'd want the window system to be frozen, while in less extreme cases you'd only want some of the functionality to be unavailable to the end user. Reading Window System API guru Stan Aubrecht's blog today, you'll quickly see that this will now no longer be a problem. On suites (i.e., either the container for modules or the NetBeans Platform Application project type itself), there'll be a new tab in the Project Properties file, as follows:

By default, all the checkboxes are selected, so all the powerful features of the window system are available by default. But, depending on which checkboxes you uncheck, one or more of the features will be removed. By the way, the Help button in the screenshot above currently returns no content because it needs to be added (by me).

If ALL the checkboxes are selected, a properties file with this content is generated in the "branding" folder (which is visible when you look in the Files window, for NetBeans Platform applications):


If all of the above are set, the small X in the tab of all the windows will not be there, so that the windows can't be closed, as well as all the other features being disabled. The above file is found (i.e., it is created for you when you select one/more of the checkboxes above) in the following location:


You could create that file yourself and add the content above yourself, however, using the checkboxes in the new tab is obviously easier.

For further reading, go as always to the NetBeans API Changes document and there read the item Added a group of resource bundle properties for customization of window system behavior.

Join the discussion

Comments ( 3 )
  • Isak Tuesday, June 17, 2008

    That's cool.

    Now, what if I'd like the singleton TopComponent instance to be not only fixed in the editor part of NB, but also have no tab on top?

    Say I build a paint application and I'd like one single painting editor and no other editors to be possible. All the settings components, all the output windows etc. that I can drag around are welcome, but in the middle, as if directly on the root pane, is the paint panel, and it cannot be closed. So obviously, since it cannot be closed and will always be the only component, I'd like it to look like MSIE before version 7, i.e. without the tab. Is this possible or has it been considered to be an option?

  • stan Wednesday, June 18, 2008

    Isak: you'd have to write a new (mostly empty) implementation of editor tab UI

  • Geertjan Wednesday, June 18, 2008
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.