Browse Source

Check for possible null rect.

pull/189/head
weisj 4 years ago
parent
commit
6ddbb36c97
  1. 3
      core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextFieldUI.java

3
core/src/main/java/com/github/weisj/darklaf/ui/text/DarkTextFieldUI.java

@ -143,6 +143,8 @@ public class DarkTextFieldUI extends DarkTextFieldUIBridge implements PropertyCh
@Override @Override
protected Rectangle getVisibleEditorRect() { protected Rectangle getVisibleEditorRect() {
Rectangle rect = super.getVisibleEditorRect(); Rectangle rect = super.getVisibleEditorRect();
System.out.println(editor);
if (rect != null) {
FontMetrics fm = SwingUtilities2.getFontMetrics(editor, editor.getFont()); FontMetrics fm = SwingUtilities2.getFontMetrics(editor, editor.getFont());
int asc = fm.getMaxAscent(); int asc = fm.getMaxAscent();
Insets ins = editor.getInsets(); Insets ins = editor.getInsets();
@ -150,6 +152,7 @@ public class DarkTextFieldUI extends DarkTextFieldUIBridge implements PropertyCh
rect.y = ins.top + (height - asc) / 2; rect.y = ins.top + (height - asc) / 2;
rect.y -= fm.getDescent() / 2; rect.y -= fm.getDescent() / 2;
adjustTextRect(getComponent(), rect); adjustTextRect(getComponent(), rect);
}
return rect; return rect;
} }

Loading…
Cancel
Save