override fun paintBorder()

in src/main/kotlin/com/jetbrains/rider/ezargs/ui/platformCustomization/CustomDarculaComboBoxUI.kt [19:48]


    override fun paintBorder(c: Component?, g: Graphics, x: Int, y: Int, width: Int, height: Int) {
        if (c !is JComponent) return
        val g2 = g.create() as Graphics2D
        val bw = DarculaUIUtil.BW.float
        val r = Rectangle(x, y, width, height)
        try {
            checkFocus()
            if (!DarculaUIUtil.isTableCellEditor(c)) {
                g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
                g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE)
                JBInsets.removeFrom(r, JBUI.insets(1))
                g2.translate(r.x, r.y)
                val lw = DarculaUIUtil.LW.float
                val op = DarculaUIUtil.getOutline(comboBox)
                if (comboBox.isEnabled && op != null) {
                    val color = c.getClientProperty("CustomBorderColor") as? Color ?: DarculaUIUtil.getOutlineColor(true, this.hasFocus)
                    paintOutlineBorderCustomColor(g2, r.width, r.height, DarculaUIUtil.COMPONENT_ARC.getFloat(), true, hasFocus, color)
                } else {
                    if (hasFocus && !DarculaUIUtil.isBorderless(c)) {
                        DarculaUIUtil.paintOutlineBorder(g2, r.width, r.height, DarculaUIUtil.COMPONENT_ARC.getFloat(), true, true, Outline.focus)
                    }
                    paintBorder(c, g2, if (DarculaUIUtil.isBorderless(c)) lw else bw, r, lw, DarculaUIUtil.COMPONENT_ARC.getFloat())
                }
            } else {
                DarculaUIUtil.paintCellEditorBorder(g2, c, r, hasFocus)
            }
        } finally {
            g2.dispose()
        }
    }