All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.robocode.tankroyale.gui.ui.config.CheckListRenderer.kt Maven / Gradle / Ivy

package dev.robocode.tankroyale.gui.ui.config

import java.awt.Component
import javax.swing.*

class CheckListRenderer : JCheckBox(), ListCellRenderer {
    override fun getListCellRendererComponent(
        list: JList,
        entity: CheckListEntity,
        index: Int,
        isSelected: Boolean,
        hasFocus: Boolean,
    ): Component {
        isEnabled = list.isEnabled
        setSelected(entity.isActive)
        font = list.font
        background = if (isSelected) list.selectionBackground else list.background
        foreground = if (isSelected) list.selectionForeground else list.foreground
        text = entity.label
        return this
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy