mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 06:20:53 +03:00
fixed missing focus indicators in heavy-weight popups (issue #273)
This commit is contained in:
@@ -18,6 +18,7 @@ FlatLaf Change Log
|
|||||||
(issue #275)
|
(issue #275)
|
||||||
- Custom window decorations: Fixed right aligned progress bar in embedded menu
|
- Custom window decorations: Fixed right aligned progress bar in embedded menu
|
||||||
bar was overlapping window title. (issue #272)
|
bar was overlapping window title. (issue #272)
|
||||||
|
- Fixed missing focus indicators in heavy-weight popups. (issue #273)
|
||||||
- InternalFrame: Fixed translucent internal frame menu bar background if
|
- InternalFrame: Fixed translucent internal frame menu bar background if
|
||||||
`TitlePane.unifiedBackground` is `true`. (issue #274)
|
`TitlePane.unifiedBackground` is `true`. (issue #274)
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,8 @@ public class FlatUIUtils
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the given component is the permanent focus owner and
|
* Returns whether the given component is the permanent focus owner and
|
||||||
* is in the active window. Used to paint focus indicators.
|
* is in the active window or in a popup window owned by the active window.
|
||||||
|
* Used to paint focus indicators.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings( "unchecked" )
|
@SuppressWarnings( "unchecked" )
|
||||||
public static boolean isPermanentFocusOwner( Component c ) {
|
public static boolean isPermanentFocusOwner( Component c ) {
|
||||||
@@ -195,12 +196,18 @@ public class FlatUIUtils
|
|||||||
Object value = ((JComponent)c).getClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER );
|
Object value = ((JComponent)c).getClientProperty( FlatClientProperties.COMPONENT_FOCUS_OWNER );
|
||||||
if( value instanceof Predicate ) {
|
if( value instanceof Predicate ) {
|
||||||
return ((Predicate<JComponent>)value).test( (JComponent) c ) &&
|
return ((Predicate<JComponent>)value).test( (JComponent) c ) &&
|
||||||
keyboardFocusManager.getActiveWindow() == SwingUtilities.windowForComponent( c );
|
isInActiveWindow( c, keyboardFocusManager.getActiveWindow() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return keyboardFocusManager.getPermanentFocusOwner() == c &&
|
return keyboardFocusManager.getPermanentFocusOwner() == c &&
|
||||||
keyboardFocusManager.getActiveWindow() == SwingUtilities.windowForComponent( c );
|
isInActiveWindow( c, keyboardFocusManager.getActiveWindow() );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isInActiveWindow( Component c, Window activeWindow ) {
|
||||||
|
Window window = SwingUtilities.windowForComponent( c );
|
||||||
|
return window == activeWindow ||
|
||||||
|
(window != null && window.getType() == Window.Type.POPUP && window.getOwner() == activeWindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user