mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 06:57:13 -06:00
FlatInspector: fixed highlight figure bounds of windows; limit used inspection level to existing components
This commit is contained in:
@@ -226,8 +226,13 @@ public class FlatInspector
|
|||||||
private void inspect( int x, int y ) {
|
private void inspect( int x, int y ) {
|
||||||
Point pt = SwingUtilities.convertPoint( rootPane.getGlassPane(), x, y, rootPane );
|
Point pt = SwingUtilities.convertPoint( rootPane.getGlassPane(), x, y, rootPane );
|
||||||
Component c = getDeepestComponentAt( rootPane, pt.x, pt.y );
|
Component c = getDeepestComponentAt( rootPane, pt.x, pt.y );
|
||||||
for( int i = 0; i < inspectParentLevel && c != null; i++ )
|
for( int i = 0; i < inspectParentLevel && c != null; i++ ) {
|
||||||
c = c.getParent();
|
Container parent = c.getParent();
|
||||||
|
if( parent == null )
|
||||||
|
break;
|
||||||
|
|
||||||
|
c = parent;
|
||||||
|
}
|
||||||
|
|
||||||
if( c == lastComponent )
|
if( c == lastComponent )
|
||||||
return;
|
return;
|
||||||
@@ -279,9 +284,9 @@ public class FlatInspector
|
|||||||
highlightFigure.setVisible( c != null );
|
highlightFigure.setVisible( c != null );
|
||||||
|
|
||||||
if( c != null ) {
|
if( c != null ) {
|
||||||
Rectangle bounds = c.getBounds();
|
highlightFigure.setBounds( new Rectangle(
|
||||||
Rectangle highlightBounds = SwingUtilities.convertRectangle( c.getParent(), bounds, rootPane );
|
SwingUtilities.convertPoint( c, 0, 0, rootPane ),
|
||||||
highlightFigure.setBounds( highlightBounds );
|
c.getSize() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user