11package processing.app.ui
22
3+ import androidx.compose.foundation.background
4+ import androidx.compose.foundation.layout.*
5+ import androidx.compose.material.MaterialTheme
6+ import androidx.compose.material.Surface
37import androidx.compose.material.Text
48import androidx.compose.runtime.Composable
9+ import androidx.compose.ui.Alignment
10+ import androidx.compose.ui.Modifier
511import androidx.compose.ui.awt.ComposePanel
12+ import androidx.compose.ui.draw.shadow
13+ import androidx.compose.ui.graphics.Color
14+ import androidx.compose.ui.graphics.RectangleShape
15+ import androidx.compose.ui.text.font.FontStyle
16+ import androidx.compose.ui.text.font.FontWeight
17+ import androidx.compose.ui.unit.DpSize
18+ import androidx.compose.ui.unit.dp
19+ import androidx.compose.ui.unit.sp
620import androidx.compose.ui.window.Window
21+ import androidx.compose.ui.window.WindowPosition
722import androidx.compose.ui.window.application
23+ import androidx.compose.ui.window.rememberWindowState
24+
825import javax.swing.JFrame
926import javax.swing.SwingUtilities
1027
1128
1229class WelcomeToBeta {
1330 companion object {
31+ val windowSize = Pair (400 , 200 )
32+ val windowTitle = " Welcome to Beta"
33+ val title = " Welcome to the Processing Beta"
34+ val message = """ Thank you for trying out the new version of Processing. We’re very grateful!
35+
36+ Please report any bugs on the forums."""
37+ val buttonText = " Thank you"
38+
39+
1440 @JvmStatic
1541 fun showWelcomeToBeta () {
1642 SwingUtilities .invokeLater {
17- JFrame (" New Window Title " ).apply {
43+ JFrame (windowTitle ).apply {
1844 defaultCloseOperation = JFrame .DISPOSE_ON_CLOSE
1945 contentPane.add(ComposePanel ().apply {
2046 setContent {
2147 welcomeToBeta()
2248 }
2349 })
24- setSize(400 , 300 )
50+ // setSize(windowSize.first, windowSize.second )
2551 setLocationRelativeTo(null )
2652 isVisible = true
2753 }
@@ -30,14 +56,58 @@ class WelcomeToBeta {
3056
3157 @Composable
3258 fun welcomeToBeta () {
33- Text (" Welcome to the Beta version of Processing!" )
59+ // TODO: Add fonts and colors
60+
61+ Row (
62+ modifier = Modifier
63+ .padding(20 .dp, 10 .dp)
64+ .size(windowSize.first.dp, windowSize.second.dp),
65+ horizontalArrangement = Arrangement .spacedBy(20 .dp)
66+ )
67+ {
68+ // TODO: Add the Processing logo svg here
69+ Box (modifier = Modifier
70+ .align(Alignment .CenterVertically )
71+ .size(100 .dp, 100 .dp)
72+ .background(Color .Blue )
73+ )
74+ Column (modifier = Modifier
75+ .fillMaxHeight(),
76+ verticalArrangement = Arrangement .spacedBy(20 .dp, alignment = Alignment .CenterVertically )
77+ ) {
78+ Text (title, fontSize = 17 .sp, fontWeight = FontWeight .SemiBold )
79+ Text (message, fontSize = 13 .sp)
80+ Row {
81+ Spacer (modifier = Modifier .weight(1f ))
82+ // TODO Add button shadow and make interactive
83+ Box (
84+ modifier = Modifier
85+ .background(Color .Blue )
86+ .padding(10 .dp)
87+ .sizeIn(minWidth = 100 .dp)
88+
89+ ,
90+ contentAlignment = Alignment .Center
91+ ) {
92+ Text (buttonText, color = Color .White )
93+ }
94+ }
95+ }
96+ }
3497 }
3598
3699 @JvmStatic
37100 fun main (args : Array <String >) {
38101 application {
39- Window (onCloseRequest = ::exitApplication) {
40- welcomeToBeta()
102+ val windowState = rememberWindowState(
103+ size = DpSize .Unspecified ,
104+ position = WindowPosition (Alignment .Center )
105+ )
106+ Window (onCloseRequest = ::exitApplication, state = windowState, title = windowTitle) {
107+ Surface (color = Color .White ) {
108+ welcomeToBeta()
109+ }
110+
41111 }
42112 }
43113 }
0 commit comments