2323import java .awt .Insets ;
2424import java .awt .geom .Rectangle2D ;
2525import javax .swing .*;
26- import com . formdev . flatlaf . ui . FlatMarginBorder ;
26+ import javax . swing . border . AbstractBorder ;
2727import com .formdev .flatlaf .ui .FlatUIUtils ;
2828import com .formdev .flatlaf .util .AnimatedBorder ;
2929import com .formdev .flatlaf .util .ColorFunctions ;
@@ -133,7 +133,7 @@ private void initComponents() {
133133 * - animates focus indicator color and border width
134134 */
135135 private class AnimatedFocusFadeBorder
136- extends FlatMarginBorder
136+ extends AbstractBorder
137137 implements AnimatedBorder
138138 {
139139 // needed because otherwise the empty paint method in superclass
@@ -155,6 +155,13 @@ public void paintBorderAnimated( Component c, Graphics g, int x, int y, int widt
155155 FlatUIUtils .paintComponentBorder ( (Graphics2D ) g , x , y , width , height , 0 , lw , 0 );
156156 }
157157
158+ @ Override
159+ public Insets getBorderInsets ( Component c , Insets insets ) {
160+ insets .top = insets .bottom = UIScale .scale ( 3 );
161+ insets .left = insets .right = UIScale .scale ( 7 );
162+ return insets ;
163+ }
164+
158165 @ Override
159166 public float getValue ( Component c ) {
160167 return FlatUIUtils .isPermanentFocusOwner ( c ) ? 1 : 0 ;
@@ -174,7 +181,7 @@ public int getAnimationDuration() {
174181 * - animates focus indicator at bottom
175182 */
176183 private class AnimatedMaterialBorder
177- extends FlatMarginBorder
184+ extends AbstractBorder
178185 implements AnimatedBorder
179186 {
180187 // needed because otherwise the empty paint method in superclass
@@ -206,6 +213,20 @@ public void paintBorderAnimated( Component c, Graphics g, int x, int y, int widt
206213 } );
207214 }
208215
216+ @ Override
217+ public void repaintBorder ( Component c , int x , int y , int width , int height ) {
218+ // limit repaint to bottom border
219+ int lh = UIScale .scale ( 2 );
220+ c .repaint ( x , y + height - lh , width , lh );
221+ }
222+
223+ @ Override
224+ public Insets getBorderInsets ( Component c , Insets insets ) {
225+ insets .top = insets .bottom = UIScale .scale ( 3 );
226+ insets .left = insets .right = UIScale .scale ( 7 );
227+ return insets ;
228+ }
229+
209230 @ Override
210231 public float getValue ( Component c ) {
211232 return FlatUIUtils .isPermanentFocusOwner ( c ) ? 1 : 0 ;
@@ -245,7 +266,7 @@ public int getAnimationDuration() {
245266
246267 @ Override
247268 public Insets getBorderInsets ( Component c ) {
248- return UIScale .scale ( new Insets ( 4 , 4 , 4 , 4 ) );
269+ return UIScale .scale ( new Insets ( 3 , 7 , 3 , 7 ) );
249270 }
250271
251272 @ Override
0 commit comments