DevFaqCustomizeWindowSystem

Revision as of 16:16, 9 January 2012 by Saubrecht (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)

When developing an application based on NetBeans platform there's sometimes need to tweak the Window System for your target users. Here's a couple of tips how to use various switches and options.

Contents

Use own JFrame instance as the main window

It is possible to use any JFrame instance as the main window. Simply create the instance when your module is being loaded (ModuleInstall.restored()) and set its name to NbMainWindow. When the window system loads it will pick this instance and initialize it with menu bar, status bar, toolbars, inner desktop hierarchy etc.

Mixing document and non-document windows

As of NetBeans 7.1 it is possible to mix document and non-document windows. It means it is possible for example to drag Projects window and drop it next to Java source editor. It is also possible to drag any editor window and dock it next to Project or Output windows. If you want to turn this feature off and revert to NetBeans 7.0 behavior use Mix.Editors.And.Views.Enabled branding property in org/netbeans/core/windows/Bundle.properties bundle.

Paint custom background

Boolean property NbMainWindow.showCustomBackground set to true in UIManager will make most of main window components transparent. So anything painted to main window root pane will be showing through its toolbars, menu bar, status bar and window borders. Use this property together with custom JFrame instance (see above) to paint custom images on main window background.

Turn some features on/off on TopComponent level

When creating a new TopComponent using NetBeans New File wizard you are presented a couple of option to modify window behavior. If you need to customize the behavior of an existing TopComponent or behavior of a TopComponent you don't have sources to just use any of client properties listed below. For example:

WindowManager.getDefault().findTopComponent("output").putClientProperty("netbeans.winsys.tc.closing_disabled", Boolean.TRUE);
//nobody can close Output window now!


netbeans.winsys.tc.closing_disabled - user cannot close the window - there is no close button and Close actions in the main menu is disabled. Closing the window by calling TopComponent.close() naturally still works.

  • netbeans.winsys.tc.sliding_disabled - user cannot minimize the window.
  • netbeans.winsys.tc.undocking_disabled - user cannot float the window.
  • netbeans.winsys.tc.dragging_disabled - user cannot drag and drop the window to a different location.
  • netbeans.winsys.tc.maximization_disabled - user cannot maximize window.
  • netbeans.winsys.tc.keep_preferred_size_when_slided_in - by default minimized windows take the whole main window height or width when being shown from minimize bar. Setting this client property to true will force the window system to use TopComponent's preferred size when it is being slided in from the minimize bar.
  • netbeans.winsys.tc.draganddrop_copy_disabled - by default it is possible to clone a CloneableTopComponent by dragging its header while holding down CTRL key. To disable such cloning set this client property to true.


Turn some features on/off on window system level

If you want to customize features of all windows you can use the following branding properties. (See for example [DevFaqRenamingMenuItem here] how NetBeans branding works.)

  • TopComponent.DragAndDrop.Enabled
  • TopComponent.Undocking.Enabled
  • TopComponent.Sliding.Enabled
  • TopComponent.Resizing.Enabled
  • View.TopComponent.Closing.Enabled
  • Editor.TopComponent.Closing.Enabled
  • TopComponent.Maximization.Enabled
  • Splitter.Respect.MinimumSize.Enabled
  • WinSys.Open.New.Editors.Docked
  • WinSys.DragAndDrop.Sliding.Enabled

NetBeans version 7.1 introduced a concept of tab groups.

  • Mode.Closing.Enabled
  • Mode.Sliding.Enabled
  • Mode.View.Undocking.Enabled
  • Mode.Editor.Undocking.Enabled
  • Mode.View.DragAndDrop.Enabled
  • Mode.Editor.DragAndDrop.Enabled
  • TopComponent.Auto.Slide.In.Minimized.Mode.Enabled

Customize non-document tabs layout

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo