Skip to content

Commit

Permalink
fix: preferred sizes and demo image
Browse files Browse the repository at this point in the history
  • Loading branch information
morisil committed Aug 15, 2024
1 parent ed921ee commit fc8134e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 3 additions & 1 deletion demo/mvp-implementation/src/main/kotlin/MvpBrowserApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ package com.xemantic.kotlin.swing.demo.mvp

import com.xemantic.kotlin.swing.*
import kotlinx.coroutines.launch
import java.awt.Dimension

fun main(vararg args: String) = MainWindow("My Browser") {
fun main(vararg args: String) = MainWindow("My Browser") { window ->
window.preferredSize = Dimension(300, 300)
val internet = DefaultInternet()
val view = SwingBrowserView()
val presenter = BrowserPresenter(view, scope, internet)
Expand Down
7 changes: 2 additions & 5 deletions demo/mvp-implementation/src/main/kotlin/MvpBrowserView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
package com.xemantic.kotlin.swing.demo.mvp

import com.xemantic.kotlin.swing.*
import java.awt.Dimension

/**
* Swing implementation of the [BrowserView], could be also JavaFX, or HTML + JS or native iOS.
Expand All @@ -31,9 +30,7 @@ class SwingBrowserView : BrowserView {
private val goAction = Button("Go!") {
isEnabled = false
}
private val contentBox = TextArea {
preferredSize = Dimension(300, 300)
}
private val contentBox = TextArea()

override val urlEdits = urlField.textChanges
override val goActions = goAction.actionEvents.asActions
Expand Down Expand Up @@ -66,7 +63,7 @@ class SwingBrowserView : BrowserView {
}
}
center {
contentBox
ScrollPane { contentBox }
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions demo/simple-kotlin-dsl/src/main/kotlin/MyBrowserKotlin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ import kotlinx.coroutines.flow.*
import java.awt.Dimension
import java.net.URI

fun main() = MainWindow("My Browser") {
fun main() = MainWindow("My Browser") { window ->
val urlBox = TextField()
val goButton = Button("Go!") { isEnabled = false }
val contentBox = TextArea {
preferredSize = Dimension(300, 300)
}
val contentBox = TextArea()

urlBox.textChanges.listen { url ->
goButton.isEnabled = url.isNotBlank()
Expand All @@ -57,6 +55,8 @@ fun main() = MainWindow("My Browser") {
goButton.isEnabled = true
}

window.preferredSize = Dimension(300, 300)

Border.empty(4) {
BorderPanel {
layout {
Expand Down
Binary file modified docs/xemantic-kotlin-swing-dsl-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fc8134e

Please sign in to comment.