1
1
package processing.app.ui
2
2
3
+ import androidx.compose.foundation.background
4
+ import androidx.compose.foundation.layout.*
5
+ import androidx.compose.material.MaterialTheme
6
+ import androidx.compose.material.Surface
3
7
import androidx.compose.material.Text
4
8
import androidx.compose.runtime.Composable
9
+ import androidx.compose.ui.Alignment
10
+ import androidx.compose.ui.Modifier
5
11
import 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
6
20
import androidx.compose.ui.window.Window
21
+ import androidx.compose.ui.window.WindowPosition
7
22
import androidx.compose.ui.window.application
23
+ import androidx.compose.ui.window.rememberWindowState
24
+
8
25
import javax.swing.JFrame
9
26
import javax.swing.SwingUtilities
10
27
11
28
12
29
class WelcomeToBeta {
13
30
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
+
14
40
@JvmStatic
15
41
fun showWelcomeToBeta () {
16
42
SwingUtilities .invokeLater {
17
- JFrame (" New Window Title " ).apply {
43
+ JFrame (windowTitle ).apply {
18
44
defaultCloseOperation = JFrame .DISPOSE_ON_CLOSE
19
45
contentPane.add(ComposePanel ().apply {
20
46
setContent {
21
47
welcomeToBeta()
22
48
}
23
49
})
24
- setSize(400 , 300 )
50
+ // setSize(windowSize.first, windowSize.second )
25
51
setLocationRelativeTo(null )
26
52
isVisible = true
27
53
}
@@ -30,14 +56,58 @@ class WelcomeToBeta {
30
56
31
57
@Composable
32
58
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
+ }
34
97
}
35
98
36
99
@JvmStatic
37
100
fun main (args : Array <String >) {
38
101
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
+
41
111
}
42
112
}
43
113
}
0 commit comments