diff --git a/src/main/kotlin/Rs2MapEditor.kt b/src/main/kotlin/Rs2MapEditor.kt index 90b9a0d..491d21a 100644 --- a/src/main/kotlin/Rs2MapEditor.kt +++ b/src/main/kotlin/Rs2MapEditor.kt @@ -238,18 +238,6 @@ object Rs2MapEditor { init { underlayMap.forEach { val underlay = UnderlaySquarePanel(it.value.getRGB(),30, it.key) - underlay.addMouseListener(object : MouseAdapter(){ - val border: Border = MatteBorder(1, 1, 1, 1, Color.GRAY) - val highlight: Border = MatteBorder(1, 1, 1, 1, Color.YELLOW) - - override fun mouseEntered(e: MouseEvent?) { - colorPointMap.filter { it.value == underlay.id }.forEach{ componentPointMap[it.key]!!.border = highlight} - } - - override fun mouseExited(e: MouseEvent?) { - colorPointMap.filter { it.value == underlay.id }.forEach{ componentPointMap[it.key]!!.border = border} - } - }) add(underlay) } val addAnUnderlay = UnderlaySquarePanel(Color.darkGray,30, "+") @@ -269,6 +257,7 @@ object Rs2MapEditor { } } val text = JLabel("$id") + text.foreground = Color((color.rgb).inv()).brighter() val defaultBackground = color @@ -278,12 +267,18 @@ object Rs2MapEditor { add(text) addMouseListener(object : MouseAdapter() { - override fun mouseEntered(e: MouseEvent) { - background = Color.BLUE + val border: Border = MatteBorder(1, 1, 1, 1, Color.GRAY) + val highlight: Border = MatteBorder(1, 1, 1, 1, Color.YELLOW) + val selectionBorder = MatteBorder(1,1,1,1, Color.WHITE) + + override fun mouseEntered(e: MouseEvent?) { + this@UnderlaySquarePanel.border = selectionBorder + colorPointMap.filter { it.value == id }.forEach{ componentPointMap[it.key]!!.border = highlight} } - override fun mouseExited(e: MouseEvent) { - background = defaultBackground + override fun mouseExited(e: MouseEvent?) { + this@UnderlaySquarePanel.border = null + colorPointMap.filter { it.value == id }.forEach{ componentPointMap[it.key]!!.border = border} } override fun mouseClicked(e: MouseEvent) {