@@ -41,6 +41,8 @@ import processing.app.Base.getVersionName
4141import processing.app.ui.theme.LocalLocale
4242import processing.app.ui.theme.LocalTheme
4343import processing.app.ui.theme.Locale
44+ import processing.app.ui.theme.PDEComposeWindow
45+ import processing.app.ui.theme.PDESwingWindow
4446import processing.app.ui.theme.ProcessingTheme
4547import java.awt.Cursor
4648import java.awt.Dimension
@@ -54,46 +56,20 @@ import javax.swing.SwingUtilities
5456
5557class WelcomeToBeta {
5658 companion object {
57- val windowSize = Dimension (400 , 200 )
58- val windowTitle = Locale ()[" beta.window.title" ]
59-
6059 @JvmStatic
6160 fun showWelcomeToBeta () {
62- val mac = SystemInfo .isMacFullWindowContentSupported
6361 SwingUtilities .invokeLater {
64- JFrame (windowTitle).apply {
65- val close = {
66- Preferences .set(" update.beta_welcome" , getRevision().toString())
67- dispose()
68- }
69- rootPane.putClientProperty(" apple.awt.transparentTitleBar" , mac)
70- rootPane.putClientProperty(" apple.awt.fullWindowContent" , mac)
71- defaultCloseOperation = JFrame .DISPOSE_ON_CLOSE
72- contentPane.add(ComposePanel ().apply {
73- size = windowSize
74- setContent {
75- ProcessingTheme {
76- Box (modifier = Modifier .padding(top = if (mac) 22 .dp else 0 .dp)) {
77- welcomeToBeta(close)
78- }
79- }
80- }
81- })
82- pack()
83- background = java.awt.Color .white
84- setLocationRelativeTo(null )
85- addKeyListener(object : KeyAdapter () {
86- override fun keyPressed (e : KeyEvent ) {
87- if (e.keyCode == KeyEvent .VK_ESCAPE ) close()
88- }
89- })
90- isResizable = false
91- isVisible = true
92- requestFocus()
62+ val close = {
63+ Preferences .set(" update.beta_welcome" , getRevision().toString())
64+ }
65+
66+ PDESwingWindow (" beta.window.title" , onClose = close) {
67+ welcomeToBeta(close)
9368 }
9469 }
9570 }
9671
72+ val windowSize = Dimension (400 , 200 )
9773 @Composable
9874 fun welcomeToBeta (close : () -> Unit = {}) {
9975 Row (
@@ -194,18 +170,9 @@ class WelcomeToBeta {
194170 @JvmStatic
195171 fun main (args : Array <String >) {
196172 application {
197- val windowState = rememberWindowState(
198- size = DpSize .Unspecified ,
199- position = WindowPosition (Alignment .Center )
200- )
201-
202- Window (onCloseRequest = ::exitApplication, state = windowState, title = windowTitle) {
203- ProcessingTheme {
204- Surface (color = colors.background) {
205- welcomeToBeta {
206- exitApplication()
207- }
208- }
173+ PDEComposeWindow (titleKey = " beta.window.title" , onClose = ::exitApplication){
174+ welcomeToBeta {
175+ exitApplication()
209176 }
210177 }
211178 }
0 commit comments