Browse Source

Update README.md (#227)

Capitalize the first letter of comments.
pull/232/head 0.3.0-build137
Ali Khaleqi Yekta 4 years ago committed by GitHub
parent
commit
b08b9ed17d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      tutorials/Window_API/README.md

26
tutorials/Window_API/README.md

@ -14,7 +14,7 @@ import javax.swing.SwingUtilities.invokeLater
fun main() = invokeLater { fun main() = invokeLater {
AppWindow().show { AppWindow().show {
// content // Content
} }
} }
``` ```
@ -25,7 +25,7 @@ import androidx.compose.desktop.Window
fun main() { fun main() {
Window { Window {
// content // Content
} }
} }
``` ```
@ -57,7 +57,7 @@ fun main() {
Dialog( Dialog(
onDismissRequest = { dialogState.value = false } onDismissRequest = { dialogState.value = false }
) { ) {
// dialog's content // Dialog's content
} }
} }
} }
@ -205,7 +205,7 @@ fun main() {
Window { Window {
val current = AppWindowAmbient.current val current = AppWindowAmbient.current
// content // Content
Box( Box(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
alignment = Alignment.Center alignment = Alignment.Center
@ -246,7 +246,7 @@ fun main() {
val windowPos = mutableStateOf(IntOffset.Zero) val windowPos = mutableStateOf(IntOffset.Zero)
Window { Window {
// content // Content
Box( Box(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
@ -289,7 +289,7 @@ import androidx.compose.material.Button
fun main() { fun main() {
Window { Window {
// content // Content
Button( Button(
onClick = { onClick = {
AppWindowAmbient.current?.setWindowCentered() AppWindowAmbient.current?.setWindowCentered()
@ -412,7 +412,7 @@ fun main() {
} }
) )
) { ) {
// content // Content
Box( Box(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
@ -432,14 +432,14 @@ The AppManager singleton is used to customize the behavior of the entire applica
1. Description of common application events 1. Description of common application events
```kotlin ```kotlin
AppManager.setEvents( AppManager.setEvents(
onAppStart = { println("onAppStart") }, // invoked before the first window is created onAppStart = { println("onAppStart") }, // Invoked before the first window is created
onAppExit = { println("onAppExit") } // invoked after all windows are closed onAppExit = { println("onAppExit") } // Invoked after all windows are closed
) )
``` ```
2. Customization of common application context menu 2. Customization of common application context menu
```kotlin ```kotlin
AppManager.setMenu( AppManager.setMenu(
getCommonAppMenuBar() // custom function that returns MenuBar getCommonAppMenuBar() // Custom function that returns MenuBar
) )
``` ```
3. Access to the application windows list 3. Access to the application windows list
@ -452,7 +452,7 @@ val current = AppManager.focusedWindow
``` ```
5. Application exit 5. Application exit
```kotlin ```kotlin
AppManager.exit() // closes all windows AppManager.exit() // Closes all windows
``` ```
## Access to Swing components ## Access to Swing components
@ -474,7 +474,7 @@ import androidx.compose.ui.Modifier
fun main() { fun main() {
val scaleFactor = mutableStateOf(0.0) val scaleFactor = mutableStateOf(0.0)
Window { Window {
// content // Content
Box( Box(
modifier = Modifier.fillMaxSize(), modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center contentAlignment = Alignment.Center
@ -485,7 +485,7 @@ fun main() {
val current = AppManager.focusedWindow val current = AppManager.focusedWindow
if (current != null) { if (current != null) {
val jFrame = current.window val jFrame = current.window
// do whatever you want with it // Do whatever you want with it
scaleFactor.value = jFrame.graphicsConfiguration.defaultTransform.scaleX scaleFactor.value = jFrame.graphicsConfiguration.defaultTransform.scaleX
} }
} }

Loading…
Cancel
Save