mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-09 08:15:09 +03:00
PasswordField: paint caps lock icon on left side in right-to-left component orientation
This commit is contained in:
@@ -36,6 +36,8 @@ FlatLaf Change Log
|
||||
- OptionPane: Align wrapped lines to the right if component orientation is
|
||||
right-to-left. (issue #350)
|
||||
- PasswordField: Caps lock icon no longer painted over long text. (issue #172)
|
||||
- PasswordField: Paint caps lock icon on left side in right-to-left component
|
||||
orientation.
|
||||
- Window decorations: Window title bar width is no longer considered when
|
||||
calculating preferred/minimum width of window. (issue #351)
|
||||
|
||||
|
||||
@@ -177,7 +177,9 @@ public class FlatPasswordFieldUI
|
||||
|
||||
JTextComponent c = getComponent();
|
||||
int y = (c.getHeight() - capsLockIcon.getIconHeight()) / 2;
|
||||
int x = c.getWidth() - capsLockIcon.getIconWidth() - y;
|
||||
int x = c.getComponentOrientation().isLeftToRight()
|
||||
? c.getWidth() - capsLockIcon.getIconWidth() - y
|
||||
: y;
|
||||
capsLockIcon.paintIcon( c, g, x, y );
|
||||
}
|
||||
|
||||
@@ -202,6 +204,8 @@ public class FlatPasswordFieldUI
|
||||
if( !isCapsLockVisible() )
|
||||
return padding;
|
||||
|
||||
return FlatUIUtils.addInsets( padding, new Insets( 0, 0, 0, capsLockIcon.getIconWidth() ) );
|
||||
boolean ltr = getComponent().getComponentOrientation().isLeftToRight();
|
||||
int iconWidth = capsLockIcon.getIconWidth();
|
||||
return FlatUIUtils.addInsets( padding, new Insets( 0, ltr ? 0 : iconWidth, 0, ltr ? iconWidth : 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user