Icon (@NotNull Icon icon) { Computable<Icon> superCall = () -> super.getScaled2xIcon(icon); return new Icon() { final ScaleContext myContext = ScaleContext.create(); Icon myIcon; @NotNull Icon getIcon() { if (myContext.update() || myIcon == null) { myIcon = superCall.compute(); } return myIcon; } @Override public void paintIcon(Component c, Graphics g, int x, int y) { getIcon().paintIcon(c, g, x, y); } @Override public int getIconWidth() { return getIcon().getIconWidth(); } @Override public int getIconHeight() { return getIcon().getIconHeight(); } }; }