Created
November 7, 2020 20:48
-
-
Save Foso/88cde0855153d8851d1368fc64404033 to your computer and use it in GitHub Desktop.
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
import androidx.compose.desktop.AppWindow | |
import androidx.compose.foundation.Text | |
import androidx.compose.foundation.layout.Column | |
import androidx.compose.material.Button | |
import androidx.compose.runtime.mutableStateOf | |
import androidx.compose.runtime.remember | |
import java.awt.BorderLayout | |
import javax.swing.JButton | |
import javax.swing.JLabel | |
import javax.swing.JPanel | |
import javax.swing.SwingUtilities.invokeLater | |
fun main() { | |
invokeLater { | |
val appWindow = AppWindow() | |
val pane = JPanel() | |
val jBtn = JButton() | |
val jlabel = JLabel() | |
jlabel.text = "LABEL" | |
pane.add(jBtn) | |
pane.add(jlabel) | |
appWindow.window.add(pane, BorderLayout.NORTH) | |
appWindow.show { | |
val scaleFactor = remember { mutableStateOf(1) } | |
jBtn.addActionListener { | |
scaleFactor.value++ | |
} | |
jBtn.text = "JButton " + scaleFactor.value | |
jlabel.text = "LAB" + scaleFactor.value | |
Column { | |
Text("HALLO" + scaleFactor.value) | |
Button(onClick = { scaleFactor.value++ }) { | |
Text("Click me") | |
} | |
} | |
} | |
} | |
} |
Author
Foso
commented
Nov 7, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment