forked from javelit/javelit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextInputExample.java
More file actions
64 lines (52 loc) · 2.16 KB
/
Copy pathTextInputExample.java
File metadata and controls
64 lines (52 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/// usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS io.javelit:javelit:0.76.0
import java.util.List;
import io.javelit.components.layout.ColumnsComponent;
import io.javelit.core.Jt;
import io.javelit.core.JtComponent;
public class TextInputExample {
public static void main(String[] args) throws InterruptedException {
String text = Jt.textInput("How are you today ?").use();
if (text != null && !text.isEmpty()) {
Jt.text("Today, you are %s!".formatted(text)).use();
}
String text2 = Jt.textInput("How are you today ? In less than 10 characters").maxChars(10).use();
if (text2 != null && !text2.isEmpty()) {
Jt.text("Today, you are %s!".formatted(text2)).key("t2").use();
}
String text3 = Jt.textInput("How are you today ? But it's a password").type("password").use();
if (text3 != null && !text3.isEmpty()) {
Jt.text("Today, you are %s!".formatted(text3)).key("t3").use();
}
String text4 = Jt.textInput("How are you today ? With some inspiration").placeholder("I'm good!").use();
if (text4 != null && !text4.isEmpty()) {
Jt.text("Today, you are %s!".formatted(text4)).key("t4").use();
}
String text5 = Jt.textInput("How are you today ? See help").help("answer whether you are good or not").use();
if (text5 != null && !text5.isEmpty()) {
Jt.text("Today, you are %s!".formatted(text5)).key("t5").use();
}
String text7 = Jt
.textInput("Mystery label - can't be seen ?")
.labelVisibility(JtComponent.LabelVisibility.HIDDEN)
.use();
if (text7 != null && !text7.isEmpty()) {
Jt
.text("The label was hidden for this one. But the corresponding space was still here ! Today you are %s!".formatted(
text7))
.key("t7")
.use();
}
String text6 = Jt
.textInput("Mystery label - can't be seen ?")
.labelVisibility(JtComponent.LabelVisibility.COLLAPSED)
.use();
if (text6 != null && !text6.isEmpty()) {
Jt
.text("The label was hidden for this one, and no corresponding space for this one ! Today you are %s!".formatted(
text6))
.key("t6")
.use();
}
}
}