-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
additional mouse events and focus events provided as Flows
- Loading branch information
Showing
3 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* This file is part of xemantic-kotlin-swing-dsl - Kotlin goodies for Java Swing. | ||
* | ||
* Copyright (C) 2024 Kazimierz Pogoda | ||
* | ||
* xemantic-kotlin-swing-dsl is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* xemantic-kotlin-swing-dsl is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with xemantic-kotlin-swing-dsl. If not, | ||
* see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.xemantic.kotlin.swing.demo | ||
|
||
import com.xemantic.kotlin.swing.* | ||
import java.awt.Dimension | ||
|
||
fun main() = MainWindow("Component Focus") { | ||
val helpBox = Label { | ||
preferredSize = Dimension(200, 0) | ||
} | ||
BorderPanel { | ||
center { helpBox } | ||
west { | ||
BoxPanel(BoxLayoutAxis.Y) { | ||
+Button("action") { | ||
focusGains.listen { | ||
helpBox.text = "Action help" | ||
} | ||
} | ||
+CheckBox("choice") { | ||
focusGains.listen { | ||
helpBox.text = "Choice help" | ||
} | ||
} | ||
+Label("label") { | ||
focusGains.listen { | ||
helpBox.text = "Label help" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters