More helpers/DRY

This commit is contained in:
downthecrop 2025-10-24 18:43:16 -07:00
parent 573e579643
commit 47e545cbc7
17 changed files with 264 additions and 289 deletions

View file

@ -608,26 +608,20 @@ class plugin : Plugin() {
// ImageCanvas with forced size
val imageCanvas = ImageCanvas(bufferedImageSprite).apply {
background = WIDGET_COLOR
preferredSize = imageSize
maximumSize = imageSize
minimumSize = imageSize
setFixedSize(imageSize)
}
// Wrapping the ImageCanvas in another JPanel to prevent stretching
val imageCanvasWrapper = JPanel().apply {
layout = GridBagLayout() // Keeps the layout of the wrapped panel minimal
preferredSize = imageSize
maximumSize = imageSize
minimumSize = imageSize
setFixedSize(imageSize)
isOpaque = false // No background for the wrapper
add(imageCanvas) // Adding ImageCanvas directly, layout won't stretch it
}
val panelButton = JPanel().apply {
layout = GridBagLayout()
preferredSize = buttonSize
maximumSize = buttonSize
minimumSize = buttonSize
setFixedSize(buttonSize)
background = WIDGET_COLOR
isOpaque = true