mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
TextField: fixed wrong leading/trailing icon placement if border is set to null (issue #1047)
Some checks failed
CI / build (11) (push) Has been cancelled
CI / build-on (17, ) (push) Has been cancelled
CI / build-on (21, ) (push) Has been cancelled
CI / build-on (21, 25) (push) Has been cancelled
CI / build-on (8, ) (push) Has been cancelled
CI / snapshot (push) Has been cancelled
CI / release (push) Has been cancelled
Some checks failed
CI / build (11) (push) Has been cancelled
CI / build-on (17, ) (push) Has been cancelled
CI / build-on (21, ) (push) Has been cancelled
CI / build-on (21, 25) (push) Has been cancelled
CI / build-on (8, ) (push) Has been cancelled
CI / snapshot (push) Has been cancelled
CI / release (push) Has been cancelled
This commit is contained in:
@@ -3,6 +3,8 @@ FlatLaf Change Log
|
|||||||
|
|
||||||
## 3.7-SNAPSHOT
|
## 3.7-SNAPSHOT
|
||||||
|
|
||||||
|
- TextField: Fixed wrong leading/trailing icon placement if border is set to
|
||||||
|
`null`. (issue #1047)
|
||||||
- Extras: UI defaults inspector: Exclude inspector window from being blocked by
|
- Extras: UI defaults inspector: Exclude inspector window from being blocked by
|
||||||
modal dialogs. (issue #1048)
|
modal dialogs. (issue #1048)
|
||||||
|
|
||||||
|
|||||||
@@ -628,7 +628,7 @@ debug*/
|
|||||||
/**
|
/**
|
||||||
* Returns the rectangle used to paint leading and trailing icons.
|
* Returns the rectangle used to paint leading and trailing icons.
|
||||||
* It invokes {@code super.getVisibleEditorRect()} and reduces left and/or
|
* It invokes {@code super.getVisibleEditorRect()} and reduces left and/or
|
||||||
* right margin if the text field has leading or trailing icons or components.
|
* right insets if the text field has leading or trailing icons or components.
|
||||||
* Also, the preferred widths of leading and trailing components are removed.
|
* Also, the preferred widths of leading and trailing components are removed.
|
||||||
*
|
*
|
||||||
* @since 2
|
* @since 2
|
||||||
@@ -660,24 +660,24 @@ debug*/
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if a leading/trailing icons (or components) are shown, then the left/right margins are reduced
|
// if a leading/trailing icons (or components) are shown, then the left/right insets are reduced
|
||||||
// to the top margin, which places the icon nicely centered on left/right side
|
// to the top inset, which places the icon nicely centered on left/right side
|
||||||
if( leftVisible || (ltr ? hasLeadingIcon() : hasTrailingIcon()) ) {
|
if( leftVisible || (ltr ? hasLeadingIcon() : hasTrailingIcon()) ) {
|
||||||
// reduce left margin
|
// reduce left inset
|
||||||
Insets margin = getComponent().getMargin();
|
Insets insets = getComponent().getInsets();
|
||||||
int newLeftMargin = Math.min( margin.left, margin.top );
|
int newLeftInset = Math.min( insets.left, insets.top );
|
||||||
if( newLeftMargin < margin.left ) {
|
if( newLeftInset < insets.left ) {
|
||||||
int diff = scale( margin.left - newLeftMargin );
|
int diff = insets.left - newLeftInset;
|
||||||
r.x -= diff;
|
r.x -= diff;
|
||||||
r.width += diff;
|
r.width += diff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( rightVisible || (ltr ? hasTrailingIcon() : hasLeadingIcon()) ) {
|
if( rightVisible || (ltr ? hasTrailingIcon() : hasLeadingIcon()) ) {
|
||||||
// reduce right margin
|
// reduce right inset
|
||||||
Insets margin = getComponent().getMargin();
|
Insets insets = getComponent().getInsets();
|
||||||
int newRightMargin = Math.min( margin.right, margin.top );
|
int newRightInset = Math.min( insets.right, insets.top );
|
||||||
if( newRightMargin < margin.left )
|
if( newRightInset < insets.left )
|
||||||
r.width += scale( margin.right - newRightMargin );
|
r.width += insets.right - newRightInset;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure that width and height are not negative
|
// make sure that width and height are not negative
|
||||||
|
|||||||
Reference in New Issue
Block a user