@@ -4,6 +4,7 @@ import com.intellij.openapi.actionSystem.ActionUpdateThread
44import com.intellij.openapi.actionSystem.AnActionEvent
55import com.intellij.openapi.project.DumbAwareAction
66import com.intellij.ui.JBColor
7+ import com.intellij.ui.scale.JBUIScale
78import com.intellij.util.ui.UIUtil
89import com.intellij.util.ui.UIUtil.drawCenteredString
910import krasa.editorGroups.EditorGroupManager
@@ -23,6 +24,7 @@ class GroupLinksCountAction : DumbAwareAction() {
2324 val count = currentGroup.size(project)
2425
2526 e.presentation.icon = CompositeIcon (count)
27+ e.presentation.text = count.toString()
2628 }
2729
2830 internal class CompositeIcon (private val counter : Int ) : Icon {
@@ -32,13 +34,15 @@ class GroupLinksCountAction : DumbAwareAction() {
3234 override fun paintIcon (c : Component ? , g : Graphics , x : Int , y : Int ) {
3335 val counterText = counter.toString()
3436 val g2d = g as Graphics2D
37+ g2d.setRenderingHint(RenderingHints .KEY_ANTIALIASING , RenderingHints .VALUE_ANTIALIAS_ON )
38+ g2d.setRenderingHint(RenderingHints .KEY_TEXT_ANTIALIASING , RenderingHints .VALUE_TEXT_ANTIALIAS_ON )
3539 val fontSize = if (counter < 100 ) FONT_SIZE else SMALL_FONT_SIZE
3640
3741 g2d.color = backgroundColor
3842 g2d.fillOval(x, y, ICON_SIZE , ICON_SIZE )
3943
4044 g2d.color = UIUtil .getPanelBackground()
41- g2d.font = g2d.font.deriveFont(fontSize)
45+ g2d.font = g2d.font.deriveFont(fontSize.toFloat() )
4246 drawCenteredString(
4347 g2d,
4448 Rectangle (x, y, ICON_SIZE , ICON_SIZE ),
@@ -52,8 +56,8 @@ class GroupLinksCountAction : DumbAwareAction() {
5256 }
5357
5458 companion object {
55- private const val FONT_SIZE = 10.0f
56- private const val SMALL_FONT_SIZE = 8.0f
57- private const val ICON_SIZE = 16
59+ private val FONT_SIZE = JBUIScale .scale( 10 )
60+ private val SMALL_FONT_SIZE = JBUIScale .scale( 8 )
61+ private val ICON_SIZE = JBUIScale .scale( 16 )
5862 }
5963}
0 commit comments