mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 09:03:31 +07:00
debugger color icon renderer minor ui fixes
This commit is contained in:
@@ -533,7 +533,7 @@ public class NodeRendererSettings implements PersistentStateComponent<Element> {
|
||||
if (valueField != null) {
|
||||
final Value rgbValue = objRef.getValue(valueField);
|
||||
if (rgbValue instanceof IntegerValue) {
|
||||
return new ColorIcon(13, new Color(((IntegerValue)rgbValue).value()));
|
||||
return new ColorIcon(16, 12, new Color(((IntegerValue)rgbValue).value()), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,23 @@ import java.awt.*;
|
||||
*/
|
||||
public class ColorIcon extends EmptyIcon {
|
||||
private final Color myColor;
|
||||
private boolean myBorder;
|
||||
private int myColorSize;
|
||||
|
||||
public ColorIcon(int size, @NotNull Color color) {
|
||||
|
||||
public ColorIcon(int size, int colorSize, @NotNull Color color, final boolean border) {
|
||||
super(size, size);
|
||||
myColor = color;
|
||||
myColorSize = colorSize;
|
||||
myBorder = border;
|
||||
}
|
||||
|
||||
public ColorIcon(int size, @NotNull Color color, final boolean border) {
|
||||
this(size, size, color, border);
|
||||
}
|
||||
|
||||
public ColorIcon(int size, @NotNull Color color) {
|
||||
this(size, color, false);
|
||||
}
|
||||
|
||||
public Color getIconColor() {
|
||||
@@ -39,6 +52,15 @@ public class ColorIcon extends EmptyIcon {
|
||||
final int iconWidth = getIconWidth();
|
||||
final int iconHeight = getIconHeight();
|
||||
g.setColor(getIconColor());
|
||||
g.fillRect(i, j, iconWidth, iconHeight);
|
||||
|
||||
final int x = i + (iconWidth - myColorSize) / 2;
|
||||
final int y = j + (iconHeight - myColorSize) / 2;
|
||||
|
||||
g.fillRect(x, y, myColorSize, myColorSize);
|
||||
|
||||
if (myBorder) {
|
||||
g.setColor(Color.BLACK);
|
||||
g.drawRect(x, y, myColorSize, myColorSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user