11package dartzee.theme
22
33import java.awt.BorderLayout
4+ import java.awt.Color
45import java.awt.event.ActionEvent
56import java.awt.event.ActionListener
67import javax.swing.JButton
78import javax.swing.JPanel
9+ import javax.swing.border.TitledBorder
10+ import net.miginfocom.swing.MigLayout
811
912class ThemeSelector : JPanel (), ActionListener {
1013 private val themeIds = ThemeId .values().toList()
1114
15+ private val panelRight = JPanel ()
16+ private val panelLeft = JPanel ()
1217 private val btnRight = JButton ()
1318 private val btnLeft = JButton ()
1419 private var themePanel = ThemePanel (ThemeId .None )
1520 private val actionListeners = mutableListOf<ActionListener >()
1621
22+ private val titleBorder =
23+ TitledBorder (null , " Theme" , TitledBorder .LEADING , TitledBorder .TOP , null , null )
24+
1725 init {
26+ border = titleBorder
27+
1828 setLayout(BorderLayout (20 , 0 ))
1929
2030 btnRight.icon = themedIcon(" /buttons/rightArrow.png" )
2131 btnLeft.icon = themedIcon(" /buttons/leftArrow.png" )
2232
23- add(btnLeft, BorderLayout .WEST )
24- add(btnRight, BorderLayout .EAST )
33+ panelLeft.layout = MigLayout (" al center center" )
34+ panelLeft.add(btnLeft)
35+
36+ panelRight.layout = MigLayout (" al center center" )
37+ panelRight.add(btnRight)
38+
39+ add(panelLeft, BorderLayout .WEST )
40+ add(panelRight, BorderLayout .EAST )
2541 add(themePanel, BorderLayout .CENTER )
2642
2743 btnLeft.addActionListener(this )
@@ -43,8 +59,17 @@ class ThemeSelector : JPanel(), ActionListener {
4359 btnRight.icon = themedIcon(" /buttons/rightArrow.png" , themePanel.theme)
4460 btnLeft.icon = themedIcon(" /buttons/leftArrow.png" , themePanel.theme)
4561
46- btnLeft.background = themePanel.theme?.primary
47- btnRight.background = themePanel.theme?.primary
62+ val btnColour = themePanel.theme?.primary ? : Color (169 , 176 , 190 )
63+ val bg = themePanel.theme?.background ? : Color (214 , 217 , 223 )
64+
65+ btnLeft.background = btnColour
66+ btnRight.background = btnColour
67+
68+ titleBorder.titleColor = themePanel.theme?.fontColor ? : Color .BLACK
69+
70+ panelRight.background = bg
71+ panelLeft.background = bg
72+ background = bg
4873 }
4974
5075 private fun nextPressed () {
0 commit comments