mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-20 05:20:24 -07:00
More helpers/DRY
This commit is contained in:
parent
573e579643
commit
47e545cbc7
17 changed files with 264 additions and 289 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue