mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-130808 Settings dialog: search field: clean icon disappears when focus is off the field
Also, I fixed the issue with HAND cursor over the hidden icon.
This commit is contained in:
+13
-9
@@ -18,6 +18,7 @@ package com.intellij.ide.ui.laf.darcula.ui;
|
||||
import com.intellij.ide.ui.laf.darcula.DarculaUIUtil;
|
||||
import com.intellij.openapi.ui.GraphicsConfig;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.util.ui.JBInsets;
|
||||
|
||||
@@ -103,15 +104,18 @@ public class DarculaTextFieldUI extends BasicTextFieldUI {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasText() {
|
||||
JTextComponent component = getComponent();
|
||||
return (component != null) && !StringUtil.isEmpty(component.getText());
|
||||
}
|
||||
|
||||
private SearchAction getActionUnder(MouseEvent e) {
|
||||
final Point cPoint = getClearIconCoord();
|
||||
final Point sPoint = getSearchIconCoord();
|
||||
cPoint.x+=8;
|
||||
cPoint.y+=8;
|
||||
sPoint.x+=8;
|
||||
sPoint.y+=8;
|
||||
final Point ePoint = e.getPoint();
|
||||
return cPoint.distance(ePoint) <= 8 ? SearchAction.CLEAR : sPoint.distance(ePoint) <= 8 ? SearchAction.POPUP : null;
|
||||
Point point = new Point(e.getX() - 8, e.getY() - 8);
|
||||
return point.distance(getSearchIconCoord()) <= 8
|
||||
? SearchAction.POPUP
|
||||
: hasText() && point.distance(getClearIconCoord()) <= 8
|
||||
? SearchAction.CLEAR
|
||||
: null;
|
||||
}
|
||||
|
||||
protected Rectangle getDrawingRect() {
|
||||
@@ -169,7 +173,7 @@ public class DarculaTextFieldUI extends BasicTextFieldUI {
|
||||
searchIcon = IconLoader.findIcon("/com/intellij/ide/ui/laf/icons/search.png", DarculaTextFieldUI.class, true);
|
||||
}
|
||||
searchIcon.paintIcon(null, g, p.x, p.y);
|
||||
if (getComponent().hasFocus() && getComponent().getText().length() > 0) {
|
||||
if (hasText()) {
|
||||
p = getClearIconCoord();
|
||||
Icon clearIcon = UIManager.getIcon("TextField.darcula.clear.icon");
|
||||
if (clearIcon == null) {
|
||||
|
||||
Reference in New Issue
Block a user