override fun paintSafely()

in src/main/kotlin/com/jetbrains/rider/ezargs/ui/platformCustomization/CustomTextFieldWithPopupHandlerUI.kt [34:70]


    override fun paintSafely(g: Graphics?) {
        val component = component
        if (!component.isOpaque) paintBackground(g)
        val clip = g!!.clip
        super.paintSafely(g)
        val icons = try {
            iconsPrivateField?.get(this)
        }
        catch (t: Throwable) {
            thisLogger().warn("Unable to access icons private field", t)
            null
        } as? LinkedHashMap<String, IconHolder>
        if (!icons.isNullOrEmpty()) {
            g.clip = clip
            for (holder in icons.values) {
                if (holder.icon != null) {
                    if (holder.hovered && holder.isClickable && holder.icon !== AllIcons.Actions.CloseHovered && NewUI.isEnabled()) {
                        GraphicsUtil.setupAAPainting(g)
                        val arc = DarculaUIUtil.BUTTON_ARC.get()
                        g.color = JBColor.namedColor("MainToolbar.Dropdown.hoverBackground", JBColor.background())
                        g.fillRoundRect(
                            holder.bounds.x,
                            holder.bounds.y,
                            holder.bounds.width,
                            holder.bounds.height,
                            arc,
                            arc
                        )
                    }
                    holder.icon.paintIcon(
                        component, g, holder.bounds.x + (holder.bounds.width - holder.icon.iconWidth) / 2,
                        holder.bounds.y + (holder.bounds.height - holder.icon.iconHeight) / 2
                    )
                }
            }
        }
    }