Helper class that decorates the standard desktop manager and prevents it from moving desktop panels outside the desktop.
Implementation note : the width of internal frames includes their borders. The size of borders is obtained with panel.getInsets()
. Depending on the look and feel installed, the space occupied by borders may not be selectable. Furthermore, with Aqua l&f for example, there is an extra inside area on the right of panel where mouse clicks are ignored and thus the panel cannot be dragged by a click in there. Also, it is very difficult for us humans to notice a region on the screen that can be selected with the mouse if that region is only a couple of pixels wide or tall. For all these reasons, it is better to leave a minimum of selectable-draggable portion of the panel visible in the desktop so the user does not loose its panel outside the desktop. That is the purpose of horizontalInsetFactor
and verticalInsetFactor
fields of BoundsAwareDesktopManager
: on windows and linux default l&f, the insets are small and trial and error lead to a factor of 6 for computing the comfortable minimal space to leave visible on the desktop. On Aqua l&f (i.e. on Mac), the insets are bigger, leading to a factor of 3 as a comfortable minimal space horizontally and a factor of 1 vertically, because the underlying UI implementation prevents dragging the title bar beyond the desktop panel highest Y-boundaries..