mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-09 16:45:46 -07:00
Additional theme support + dynamic scrolling for resized views
This commit is contained in:
parent
fce9b4eea7
commit
c917981ef8
3 changed files with 6 additions and 3 deletions
|
|
@ -17,6 +17,7 @@ class ScrollablePanel(private val content: JPanel) : JPanel() {
|
|||
private var scrollbarY = 0
|
||||
private var showScrollbar = false
|
||||
private var draggingScrollPill = false
|
||||
private var lastSize = 0
|
||||
|
||||
// Define a buffer for the view height (extra space for smoother scrolling)
|
||||
private val viewBuffer = -30
|
||||
|
|
@ -68,6 +69,8 @@ class ScrollablePanel(private val content: JPanel) : JPanel() {
|
|||
Timer().schedule(object : TimerTask() {
|
||||
override fun run() {
|
||||
updateScrollbar()
|
||||
if(lastSize != content.preferredSize.height.coerceAtLeast(frame.height + viewBuffer))
|
||||
handleResize()
|
||||
}
|
||||
}, 0, 1000)
|
||||
|
||||
|
|
@ -84,7 +87,8 @@ class ScrollablePanel(private val content: JPanel) : JPanel() {
|
|||
bounds = Rectangle(0, 0, 242, frame.height)
|
||||
|
||||
// Dynamically update content bounds and scrollbar on frame resize with buffer
|
||||
content.bounds = Rectangle(0, 0, 242, content.preferredSize.height.coerceAtLeast(frame.height + viewBuffer))
|
||||
lastSize = content.preferredSize.height.coerceAtLeast(frame.height + viewBuffer)
|
||||
content.bounds = Rectangle(0, 0, 242, lastSize)
|
||||
showScrollbar = content.height > frame.height
|
||||
|
||||
currentOffsetY = 0
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ object Themes {
|
|||
ThemeType.SARADOMIN -> Theme(
|
||||
widgetColor = Color(62, 53, 41),
|
||||
titleBarColor = Color(111, 93, 69).darker(),
|
||||
viewBackgroundColor = Color(111, 93, 69),
|
||||
viewBackgroundColor = Color(101, 85, 63),
|
||||
primaryColor = Color(180, 150, 120),
|
||||
secondaryColor = Color(230, 210, 190),
|
||||
popupBackground = Color(70, 56, 42),
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ import java.awt.event.ActionListener
|
|||
import java.awt.event.MouseAdapter
|
||||
import java.awt.event.MouseEvent
|
||||
import javax.swing.*
|
||||
import javax.swing.plaf.nimbus.AbstractRegionPainter
|
||||
|
||||
|
||||
@Target(AnnotationTarget.FIELD)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue