Hidden deprecated DescriptionLabel component

GitOrigin-RevId: 505412f6939b021f2f4107d2027b263c130cda79
This commit is contained in:
Pavel Porvatov
2025-02-23 23:26:56 +00:00
committed by intellij-monorepo-bot
parent f38b970dcc
commit 471705cd8b
2 changed files with 20 additions and 2 deletions
@@ -1,8 +1,10 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.ui
import com.intellij.util.ui.UIUtil
import java.awt.BorderLayout
import javax.swing.JCheckBox
import javax.swing.JLabel
import javax.swing.JPanel
import javax.swing.UIManager
import javax.swing.border.EmptyBorder
@@ -16,9 +18,25 @@ class CheckBoxWithDescription(val checkBox: JCheckBox, description: String?) : J
if (description != null) {
val iconSize = checkBox.preferredSize.height
val desc = DescriptionLabel(description)
val desc = DescriptionLabelCopy(description)
desc.border = EmptyBorder(0, iconSize + UIManager.getInt("CheckBox.textIconGap"), 0, 0)
add(desc, BorderLayout.CENTER)
}
}
}
private class DescriptionLabelCopy(text: String?) : JLabel() {
init {
setText(text)
}
override fun updateUI() {
super.updateUI()
setForeground(UIUtil.getLabelDisabledForeground())
var size = getFont().getSize()
if (size >= 12) {
size -= 2
}
setFont(getFont().deriveFont(size.toFloat()))
}
}
@@ -4,7 +4,7 @@ package com.intellij.openapi.ui
import com.intellij.util.ui.UIUtil
import javax.swing.JLabel
@Deprecated("Use Kotlin UI DSL 2, for description use {@link com.intellij.ui.dsl.builder.Cell#comment}")
@Deprecated("Use Kotlin UI DSL 2, for description use {@link com.intellij.ui.dsl.builder.Cell#comment}", level = DeprecationLevel.HIDDEN)
class DescriptionLabel(text: String?) : JLabel() {
init {
setText(text)