mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-14 15:57:12 -06:00
Window decorations: Fixed NPE in FlatTitlePane.findHorizontalGlue() (issue #275)
This commit is contained in:
@@ -1,6 +1,14 @@
|
|||||||
FlatLaf Change Log
|
FlatLaf Change Log
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
## 1.2-SNAPSHOT
|
||||||
|
|
||||||
|
#### Fixed bugs
|
||||||
|
|
||||||
|
- Custom window decorations: Fixed NPE in `FlatTitlePane.findHorizontalGlue()`.
|
||||||
|
(issue #275)
|
||||||
|
|
||||||
|
|
||||||
## 1.1
|
## 1.1
|
||||||
|
|
||||||
#### New features and improvements
|
#### New features and improvements
|
||||||
|
|||||||
@@ -460,6 +460,9 @@ public class FlatTitlePane
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected Component findHorizontalGlue( JMenuBar menuBar ) {
|
protected Component findHorizontalGlue( JMenuBar menuBar ) {
|
||||||
|
if( menuBar == null )
|
||||||
|
return null;
|
||||||
|
|
||||||
int count = menuBar.getComponentCount();
|
int count = menuBar.getComponentCount();
|
||||||
for( int i = count - 1; i >= 0; i-- ) {
|
for( int i = count - 1; i >= 0; i-- ) {
|
||||||
Component c = menuBar.getComponent( i );
|
Component c = menuBar.getComponent( i );
|
||||||
@@ -710,9 +713,11 @@ debug*/
|
|||||||
if( r != null )
|
if( r != null )
|
||||||
hitTestSpots.add( r );
|
hitTestSpots.add( r );
|
||||||
|
|
||||||
|
JMenuBar menuBar = rootPane.getJMenuBar();
|
||||||
|
if( hasVisibleEmbeddedMenuBar( menuBar ) ) {
|
||||||
r = getNativeHitTestSpot( menuBarPlaceholder );
|
r = getNativeHitTestSpot( menuBarPlaceholder );
|
||||||
if( r != null ) {
|
if( r != null ) {
|
||||||
Component horizontalGlue = findHorizontalGlue( rootPane.getJMenuBar() );
|
Component horizontalGlue = findHorizontalGlue( menuBar );
|
||||||
if( horizontalGlue != null ) {
|
if( horizontalGlue != null ) {
|
||||||
// If menu bar is embedded and contains a horizontal glue component,
|
// If menu bar is embedded and contains a horizontal glue component,
|
||||||
// then split the hit test spot into two spots so that
|
// then split the hit test spot into two spots so that
|
||||||
@@ -736,6 +741,7 @@ debug*/
|
|||||||
|
|
||||||
hitTestSpots.add( r );
|
hitTestSpots.add( r );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FlatNativeWindowBorder.setTitleBarHeightAndHitTestSpots( window, titleBarHeight, hitTestSpots, appIconBounds );
|
FlatNativeWindowBorder.setTitleBarHeightAndHitTestSpots( window, titleBarHeight, hitTestSpots, appIconBounds );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user