FlatLaf
FlatLaf copied to clipboard
Cursor "off" by a few pixels in password field
Hi!
I have a question regarding password field, displayed
- on a high res display (4K)
- with leading icon
- and password reveal button
- using a larger font size
In this scenario, with increasing length of the types password, the cursor seems off a bit, and also selecting the text seems to paint the selection now wide enough.
Is there anything I can do on my end in terms of parameterization of the field?
Thanks!
https://user-images.githubusercontent.com/3729754/162146744-826b7717-ab35-45fa-a1cd-a62410f68c3e.mov
Hi Jens,
it seems that the string width is not computed correctly because the selection start is OK, but it ends too early.
Does this also occur in the username field or in the password field with selected reveal button?
Was not yet able to reproduce it (on macOS with Retina display; centered text and larger font or bold font). What Java version do you use? Are you using bold font? And what font family?
Thanks.
Hi Karl,
it also happens for the textfield, but to a much smaller (hardly recognizable) degree.
When revealing the password, password field seems to behave much like the text field - the effect is much smaller.
https://user-images.githubusercontent.com/3729754/162183936-1d97e1d9-4178-4d44-b9e0-8a57fc71bac8.mov
I am using a custom font - could this be an issue?
InputStream is = StartupSplashFrame.class.getResourceAsStream("/fonts/exo2/exo2-bold.ttf");
Font font = Font.createFont(Font.TRUETYPE_FONT, is);
this.jPanel5.putClientProperty(FlatClientProperties.COMPONENT_ROUND_RECT, true);
this.txtUser.setFont(font.deriveFont(Font.BOLD, 24));
this.txtUser.setForeground(DefaultColorTheme.COLOR_LOGO_BLUE);
this.txtUser.putClientProperty("JTextField.placeholderText", "Nutzername");
this.txtUser.putClientProperty("JTextField.leadingIcon", new javax.swing.ImageIcon(getClass().getResource("/com/jdimension/jlawyer/client/baseline_face_black_24dp.png")));
this.pwPassword.setFont(font.deriveFont(Font.BOLD, 24));
this.pwPassword.setForeground(DefaultColorTheme.COLOR_LOGO_BLUE);
this.pwPassword.putClientProperty("JTextField.leadingIcon", new javax.swing.ImageIcon(getClass().getResource("/com/jdimension/jlawyer/client/baseline_password_black_24dp.png")));
I am using a custom font - could this be an issue?
Maybe, but here it works even with that font (downloaded here https://fonts.google.com/specimen/Exo+2). Tried on macOS with Java 8, 11 and 17.
Please try with default font and with
this.pwPassword.setFont(this.pwPassword.getFont().deriveFont(Font.BOLD, 24));
Is the problem still there?
I just re-tried with version 3.2.1 and cannot reproduce it any longer. Closing.