| Method Signatures and Parameters | |
Jt.success(String body) | body (String) The success text to display. Markdown is supported, see |
| Chainable builder methods | |
body(String body) | The error message content to display. Markdown is supported, see |
icon(String icon) | An icon to display with the error message. The following values are valid:
null (default), no icon is displayed.
|
width(String width) | The width of the element. This can be one of the following:
|
width(int widthPixels) | The width of the element in pixels. The element will have a fixed width. If the specified width is greater than the width of the parent container, the width of the element matches the width of the parent container. |
key(String key) | A string to use as the unique key for the widget. If this is omitted, a key will be generated for the widget based on its content. No two widgets may have the same key. |
Only applies to input widgets that have a provided | |
use() | Put the widget in the app, in the |
use(JtContainer container) | Put the widget in the app, in the provided container. |
Examples
Simple success message
import io.javelit.core.Jt;
public class SuccessApp {
public static void main(String[] args) {
String username = Jt.textInput("Username").use();
if (username.isEmpty()) {
Jt.success("Username is required!").use();
} else if (username.length() > 3) {
Jt.success("Username is long enough.").use();
}
}
}
Success with markdown formatting
import io.javelit.core.Jt;
public class FormattedSuccessApp {
public static void main(String[] args) {
Jt.success("**Connection Success**: Able to connect to the database.").use();
}
}
Still have questions?
Go to our discussions forum for helpful information and advice from Javelit experts.