From 60d884dbff8aade852ea0269c50f9c20e9c1738a Mon Sep 17 00:00:00 2001 From: Krystian Panek Date: Thu, 3 Nov 2022 20:41:26 +0100 Subject: [PATCH] Scrollable pane --- .../src/main/kotlin/io/wttech/gradle/config/Definition.kt | 7 +++++++ plugin/src/main/kotlin/io/wttech/gradle/config/gui/Gui.kt | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/plugin/src/main/kotlin/io/wttech/gradle/config/Definition.kt b/plugin/src/main/kotlin/io/wttech/gradle/config/Definition.kt index 9ec5307..a2c0362 100644 --- a/plugin/src/main/kotlin/io/wttech/gradle/config/Definition.kt +++ b/plugin/src/main/kotlin/io/wttech/gradle/config/Definition.kt @@ -300,6 +300,13 @@ open class Definition(val name: String, val project: Project) { } } + init { + labelAbbrs( + "id", "url", "http", "https", "sftp", "ftp", "ssh", "aws", "az", "gcp", + "ad", "tf", "tcp", "udp", "html", "css", "js", "sso" + ) + } + companion object { const val TEMPLATE_PROP = "config" } diff --git a/plugin/src/main/kotlin/io/wttech/gradle/config/gui/Gui.kt b/plugin/src/main/kotlin/io/wttech/gradle/config/gui/Gui.kt index e326cc7..f7feebb 100644 --- a/plugin/src/main/kotlin/io/wttech/gradle/config/gui/Gui.kt +++ b/plugin/src/main/kotlin/io/wttech/gradle/config/gui/Gui.kt @@ -125,7 +125,7 @@ class Gui(val definition: Definition) { else -> throw ConfigException("Config property '${prop.name}' has invalid type!") } - class GroupTab(val group: Group, val panel: JPanel) + class GroupTab(val group: Group, val panel: JComponent) private val groupTabs = mutableListOf() private val tabPane = JTabbedPane().also { tabs -> @@ -178,7 +178,11 @@ class Gui(val definition: Definition) { }, "growx, wrap, top, hidemode 1") } } - groupTabs.add(GroupTab(group, panel)) + val scrollPane = JScrollPane(panel).apply { + horizontalScrollBarPolicy = JScrollPane.HORIZONTAL_SCROLLBAR_NEVER + verticalScrollBarPolicy = JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED + } + groupTabs.add(GroupTab(group, scrollPane)) } }