mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 22:47:13 -06:00
popups using JToolTip components did not respect their location (fixes #188; regression in 0.42 in fix for #164)
This commit is contained in:
@@ -15,6 +15,8 @@ FlatLaf Change Log
|
|||||||
#### Fixed bugs
|
#### Fixed bugs
|
||||||
|
|
||||||
- Custom window decorations: Not visible menu bar is now ignored in layout.
|
- Custom window decorations: Not visible menu bar is now ignored in layout.
|
||||||
|
- Popups using `JToolTip` components did not respect their location. (issue
|
||||||
|
#188; regression in 0.42 in fix for #164)
|
||||||
|
|
||||||
|
|
||||||
## 0.43
|
## 0.43
|
||||||
|
|||||||
@@ -218,7 +218,7 @@ public class FlatPopupFactory
|
|||||||
* 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 owner, Component contents, int x, int y ) {
|
||||||
if( !(contents instanceof JToolTip) )
|
if( !(contents instanceof JToolTip) || !wasInvokedFromToolTipManager() )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Point mouseLocation = MouseInfo.getPointerInfo().getLocation();
|
Point mouseLocation = MouseInfo.getPointerInfo().getLocation();
|
||||||
@@ -233,6 +233,16 @@ public class FlatPopupFactory
|
|||||||
return new Point( x, mouseLocation.y - tipSize.height - UIScale.scale( 20 ) );
|
return new Point( x, mouseLocation.y - tipSize.height - UIScale.scale( 20 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean wasInvokedFromToolTipManager() {
|
||||||
|
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||||
|
for( StackTraceElement stackTraceElement : stackTrace ) {
|
||||||
|
if( "javax.swing.ToolTipManager".equals( stackTraceElement.getClassName() ) &&
|
||||||
|
"showTipWindow".equals( stackTraceElement.getMethodName() ) )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//---- class NonFlashingPopup ---------------------------------------------
|
//---- class NonFlashingPopup ---------------------------------------------
|
||||||
|
|
||||||
private class NonFlashingPopup
|
private class NonFlashingPopup
|
||||||
|
|||||||
Reference in New Issue
Block a user