mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-14 07:47:12 -06:00
PopupFactory: fixed NullPointerException when PopupFactory.getPopup() is invoked with parameter owner set to null
This commit is contained in:
@@ -15,6 +15,8 @@ FlatLaf Change Log
|
|||||||
in "Look in" combobox. (Windows 10 only; issue #249)
|
in "Look in" combobox. (Windows 10 only; issue #249)
|
||||||
- Table: Fixed wrong grid line thickness in dragged column on HiDPI screens on
|
- Table: Fixed wrong grid line thickness in dragged column on HiDPI screens on
|
||||||
Java 9+. (issue #236)
|
Java 9+. (issue #236)
|
||||||
|
- PopupFactory: Fixed `NullPointerException` when `PopupFactory.getPopup()` is
|
||||||
|
invoked with parameter `owner` set to `null`.
|
||||||
|
|
||||||
|
|
||||||
## 1.0-rc3
|
## 1.0-rc3
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class FlatPopupFactory
|
|||||||
public Popup getPopup( Component owner, Component contents, int x, int y )
|
public Popup getPopup( Component owner, Component contents, int x, int y )
|
||||||
throws IllegalArgumentException
|
throws IllegalArgumentException
|
||||||
{
|
{
|
||||||
Point pt = fixToolTipLocation( owner, contents, x, y );
|
Point pt = fixToolTipLocation( contents, x, y );
|
||||||
if( pt != null ) {
|
if( pt != null ) {
|
||||||
x = pt.x;
|
x = pt.x;
|
||||||
y = pt.y;
|
y = pt.y;
|
||||||
@@ -111,6 +111,7 @@ public class FlatPopupFactory
|
|||||||
|
|
||||||
// check whether heavy weight popup window is on same screen as owner component
|
// check whether heavy weight popup window is on same screen as owner component
|
||||||
if( popupWindow == null ||
|
if( popupWindow == null ||
|
||||||
|
owner == null ||
|
||||||
popupWindow.getGraphicsConfiguration() == owner.getGraphicsConfiguration() )
|
popupWindow.getGraphicsConfiguration() == owner.getGraphicsConfiguration() )
|
||||||
return popup;
|
return popup;
|
||||||
|
|
||||||
@@ -211,7 +212,7 @@ public class FlatPopupFactory
|
|||||||
* This method checks whether the current mouse location is within tooltip bounds
|
* This method checks whether the current mouse location is within tooltip bounds
|
||||||
* and corrects the y-location so that the tooltip is placed above the mouse location.
|
* and corrects the y-location so that the tooltip is placed above the mouse location.
|
||||||
*/
|
*/
|
||||||
private Point fixToolTipLocation( Component owner, Component contents, int x, int y ) {
|
private Point fixToolTipLocation( Component contents, int x, int y ) {
|
||||||
if( !(contents instanceof JToolTip) || !wasInvokedFromToolTipManager() )
|
if( !(contents instanceof JToolTip) || !wasInvokedFromToolTipManager() )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -450,10 +451,10 @@ public class FlatPopupFactory
|
|||||||
|
|
||||||
mediumWeightShown = true;
|
mediumWeightShown = true;
|
||||||
|
|
||||||
Window window = SwingUtilities.windowForComponent( owner );
|
if( owner == null )
|
||||||
if( window == null )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Window window = SwingUtilities.windowForComponent( owner );
|
||||||
if( !(window instanceof RootPaneContainer) )
|
if( !(window instanceof RootPaneContainer) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user