mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Use display capabilities instead of hardcoded constants
GitOrigin-RevId: f31c0bff76387b9e402cdbe8bed94e35b16969fb
This commit is contained in:
committed by
intellij-monorepo-bot
parent
79e97242d9
commit
faee42ea61
+8
-2
@@ -6,6 +6,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.project.DumbAwareAction
|
||||
import com.intellij.ui.components.dialog
|
||||
import com.intellij.ui.layout.*
|
||||
import java.awt.GraphicsEnvironment
|
||||
|
||||
/**
|
||||
* @author Konstantin Bulenkov
|
||||
@@ -13,13 +14,18 @@ import com.intellij.ui.layout.*
|
||||
class ConfigureCustomSizeAction: DumbAwareAction() {
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val centerPanel = panel {
|
||||
row("Width:") { intTextField(CustomSizeModel::width, 20, 1..1000).focused() }
|
||||
row("Height:") { intTextField(CustomSizeModel::height, 20, 1..1000) }
|
||||
row("Width:") { intTextField(CustomSizeModel::width, 20, 1..maxWidth()).focused() }
|
||||
row("Height:") { intTextField(CustomSizeModel::height, 20, 1..maxHeight()) }
|
||||
}
|
||||
|
||||
dialog("Default Size", centerPanel, project = e.project).show()
|
||||
}
|
||||
|
||||
private fun maxWidth(): Int = maxWindowBounds().width
|
||||
private fun maxHeight(): Int = maxWindowBounds().height
|
||||
|
||||
private fun maxWindowBounds() = GraphicsEnvironment.getLocalGraphicsEnvironment().maximumWindowBounds
|
||||
|
||||
object CustomSizeModel {
|
||||
var width by propComponentProperty(defaultValue = 640)
|
||||
var height by propComponentProperty(defaultValue = 300)
|
||||
|
||||
Reference in New Issue
Block a user