Class Widgets
java.lang.Object
com.guinetik.hexafun.examples.tui.Widgets
Reusable TUI widget builders.
All methods return Strings (pure functions), keeping side effects
at the edges. Compose these with View for full screens.
Example:
String header = Widgets.header("My App", 80, CYAN);
String progress = Widgets.progressBar(75, 60, GREEN);
String box = Widgets.box("Content here", 40, YELLOW);
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringRender content in a single-line box.static StringRender multiple lines in a box.static StringbulletItem(String text) Render a simple bullet item.static StringError message.static StringSimple header without subtitle.static StringRender a boxed header with title and optional subtitle.static Stringhr(int width) Horizontal rule/divider.static StringInfo message.static StringRender a numbered list item.static StringMenu item with key shortcut.static StringprogressBar(int percent, int width, String fillColor) Render a progress bar.static StringDefault prompt with ">".static StringInput prompt.static StringSection divider with label.static StringPowerline-style segment for stats bars.static StringselectionItem(int index, String text) Render a numbered selection item (for menus).static StringPowerline separator arrow.static StringStatus message with arrow indicator.static StringSuccess message.static StringWarning message.
-
Method Details
-
header
Render a boxed header with title and optional subtitle.- Parameters:
title- Main title textsubtitle- Optional subtitle (can be null)width- Total width including bordersborderColor- ANSI color for the border- Returns:
- Rendered header string
-
header
Simple header without subtitle. -
section
Section divider with label.- Parameters:
label- Section labelwidth- Total width- Returns:
- Rendered divider
-
progressBar
Render a progress bar.- Parameters:
percent- Completion percentage (0-100)width- Bar width in charactersfillColor- Color for filled portion- Returns:
- Rendered progress bar
-
segment
Powerline-style segment for stats bars.- Parameters:
text- Segment textbgColor- Background colorfgColor- Foreground color- Returns:
- Rendered segment (without separator)
-
separator
Powerline separator arrow.- Parameters:
fromColor- Color of previous segmenttoColor- Color of next segment (or null for end)- Returns:
- Rendered separator
-
box
Render content in a single-line box.- Parameters:
content- Content to boxwidth- Box widthborderColor- Border color- Returns:
- Boxed content
-
box
Render multiple lines in a box.- Parameters:
lines- Content lineswidth- Box widthborderColor- Border color- Returns:
- Boxed content
-
hr
Horizontal rule/divider.- Parameters:
width- Total width- Returns:
- Rendered divider
-
listItem
public static String listItem(int index, String icon, String iconColor, String text, String textColor) Render a numbered list item.- Parameters:
index- Item numbericon- Icon to displayiconColor- Icon colortext- Item texttextColor- Text color- Returns:
- Rendered list item
-
bulletItem
Render a simple bullet item. -
selectionItem
Render a numbered selection item (for menus). -
prompt
Input prompt.- Parameters:
symbol- Prompt symbolpromptColor- Prompt color- Returns:
- Rendered prompt
-
prompt
Default prompt with ">". -
status
Status message with arrow indicator.- Parameters:
message- Status messagemessageColor- Message color- Returns:
- Rendered status
-
success
Success message. -
error
Error message. -
warning
Warning message. -
info
Info message.
-