in intellij-plugin/educational-core/src/com/jetbrains/edu/learning/taskToolWindow/ui/navigationMap/NavigationMapToolbar.kt [54:99]
override fun paintBorder(g: Graphics?, component: JComponent?, state: Int) {
g ?: return
val action = (component as ActionButton).action
if (action is NavigationMapAction) {
val rect = Rectangle(component.getSize())
JBInsets.removeFrom(rect, component.getInsets())
val isSelected = action.isSelected
val color = when {
!component.isEnabled -> EduColors.navigationMapDisabledIconBackground
isSelected -> EduColors.navigationMapIconSelectedBorder
else -> if (action.task.isSolved) EduColors.navigationMapIconSolvedBorder else EduColors.navigationMapIconNotSelectedBorder
}
val g2 = g.create() as Graphics2D
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE)
try {
g2.color = color
val arc = buttonArk
val lw = if (isSelected) DarculaUIUtil.LW.float * 2 else DarculaUIUtil.LW.float
val border = Path2D.Float(Path2D.WIND_EVEN_ODD)
border.append(
RoundRectangle2D.Float(rect.x.toFloat(), rect.y.toFloat(), rect.width.toFloat(), rect.height.toFloat(), arc, arc),
false
)
border
.append(
RoundRectangle2D.Float(
rect.x + lw,
rect.y + lw,
rect.width - lw * 2,
rect.height - lw * 2,
arc - lw / 2,
arc - lw / 2
), false
)
g2.fill(border)
}
finally {
g2.dispose()
}
}
}