### Create Basic Casciian Application with Menus (Java) Source: https://github.com/crramirez/casciian/wiki/hello-world This Java code demonstrates how to create a basic Casciian application by extending TApplication and adding standard menus for Tool, File, and Window. It requires the casciian.jar library. The application is then run using the main method. ```Java import casciian.TApplication; public class MyApplication extends TApplication { public MyApplication() throws Exception { super(BackendType.XTERM); // Create standard menus for Tool, File, and Window. addToolMenu(); addFileMenu(); addWindowMenu(); } public static void main(String [] args) throws Exception { MyApplication app = new MyApplication(); app.run(); } } ``` -------------------------------- ### Instantiate TTableWindow in Java Source: https://github.com/crramirez/casciian/wiki/widget-ttablewindow This Java code snippet demonstrates how to create a new instance of the TTableWindow class. It requires an application context and a window title as arguments. This is a basic setup for initializing the table window component. ```java new TTableWindow(getApplication(), "TTableWindow Demo"); ``` -------------------------------- ### Create Basic Casciian Application Directly (Java) Source: https://github.com/crramirez/casciian/wiki/hello-world This Java code shows an alternative way to create a Casciian application by instantiating TApplication directly and calling methods to add menus and run the application. This approach is useful for simpler cases where subclassing is not necessary. ```Java import casciian.TApplication; public class HelloWorld { public static void main(String [] args) throws Exception { TApplication app = new TApplication(TApplication.BackendType.XTERM); app.addToolMenu(); app.addFileMenu(); app.addWindowMenu(); app.run(); } } ``` -------------------------------- ### Create TTreeView with Directory and Custom Nodes Source: https://context7.com/crramirez/casciian/llms.txt Demonstrates creating a TTreeViewWidget and populating it with a directory structure starting from the current directory, as well as creating custom hierarchical tree nodes. ```java import casciian.TTreeViewWidget; import casciian.TDirectoryTreeItem; // Create tree view at position (5, 3) with size 30x15 TTreeViewWidget treeView = addTreeViewWidget(5, 3, 30, 15); // Add directory tree starting from current directory new TDirectoryTreeItem(treeView, ".", true); // Or create custom tree nodes TTreeItem root = treeView.addItem("Root"); TTreeItem child1 = root.addChild("Child 1"); TTreeItem child2 = root.addChild("Child 2"); child1.addChild("Grandchild 1"); child1.addChild("Grandchild 2"); ``` -------------------------------- ### Add TField Example in Java Source: https://github.com/crramirez/casciian/wiki/widget-tfield Demonstrates how to add a TField to a user interface using the addField method. This function likely initializes a new input field at specified coordinates with given properties. ```java addField(x, y, 15, false, "Field text"); ``` -------------------------------- ### Initialize StretchLayoutManager in Java Source: https://github.com/crramirez/casciian/wiki/layout-stretch This code snippet demonstrates how to initialize the StretchLayoutManager in Java. It requires the width and height of the layout as parameters. This is a common setup for enabling the responsive behavior of the layout manager. ```java setLayoutManager(new StretchLayoutManager(width, height)); ``` -------------------------------- ### TLabel: Create and Update Static Text Displays (Java) Source: https://context7.com/crramirez/casciian/llms.txt Demonstrates the creation of TLabel components for displaying static text. Includes examples of simple labels, labels that can be updated dynamically, and labels with custom color schemes. Requires casciian.TLabel. ```java import casciian.TLabel; // Simple label TLabel titleLabel = addLabel("User Information", 5, 2); // Label that can be updated TLabel statusLabel = addLabel("Status: Ready", 5, 4); statusLabel.setLabel("Status: Processing..."); // Colored label TLabel errorLabel = addLabel("Error occurred!", 5, 6); errorLabel.setColorKey("tlabel.inactive"); ``` -------------------------------- ### Create and Configure TRadioGroup in Java Source: https://github.com/crramirez/casciian/wiki/widget-tradiogroup Demonstrates how to create a TRadioGroup, add radio buttons to it, and configure selection requirements. This example assumes the existence of a `addRadioGroup` method and `TRadioGroup` class. ```Java TRadioGroup group = addRadioGroup(x, y, "Group 1"); group.addRadioButton("Radio option 1"); group.addRadioButton("Radio option 2", true); group.addRadioButton("Radio option 3"); group.setRequiresSelection(true); ``` -------------------------------- ### Set UTF-8 Encoding for Terminal (Bash) Source: https://github.com/crramirez/casciian/wiki/hello-world These bash commands set the LANG and LC_ALL environment variables to UTF-8, which is a requirement for Casciian to display characters correctly. This is a common troubleshooting step for garbled terminal output. ```Bash export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 ``` -------------------------------- ### Create and Populate TTable Widget Source: https://context7.com/crramirez/casciian/llms.txt Provides an example of creating a TTableWidget, setting column headers and widths, and populating cells with data to display tabular information. ```java import casciian.TTableWidget; // Create table at position (5, 3) with size 50x15, 3 columns and 10 rows TTableWidget table = addTable(5, 3, 50, 15, 3, 10); // Set column headers table.setColumnLabel(0, "Name"); table.setColumnLabel(1, "Age"); table.setColumnLabel(2, "City"); // Set column widths table.setColumnWidth(0, 20); table.setColumnWidth(1, 10); table.setColumnWidth(2, 15); // Populate data table.setCellText(0, 0, "Alice"); table.setCellText(1, 0, "30"); table.setCellText(2, 0, "New York"); table.setCellText(0, 1, "Bob"); table.setCellText(1, 1, "25"); table.setCellText(2, 1, "Boston"); ``` -------------------------------- ### Create TSplitPane for Layout Management Source: https://context7.com/crramirez/casciian/llms.txt Shows how to create both vertical and horizontal TSplitPane instances to divide screen space between two widgets, with examples of adding content to each side. ```java import casciian.TSplitPane; // Create vertical split pane at position (5, 3) with size 60x20 // true = vertical split (left/right), false = horizontal split (top/bottom) TSplitPane splitPane = addSplitPane(5, 3, 60, 20, true); // Add widgets to left and right sides TText leftContent = splitPane.getLeft().addText("Left panel content", 0, 0, 25, 18); TText rightContent = splitPane.getRight().addText("Right panel content", 0, 0, 25, 18); // Horizontal split (top/bottom) TSplitPane hSplit = addSplitPane(5, 3, 60, 20, false); TText topContent = hSplit.getTop().addText("Top panel", 0, 0, 56, 8); TText bottomContent = hSplit.getBottom().addText("Bottom panel", 0, 0, 56, 8); ``` -------------------------------- ### Display TInputBox and Get User Input (Java) Source: https://github.com/crramirez/casciian/wiki/widget-tinputbox Demonstrates how to instantiate and use the TInputBox in Java to prompt the user for input. It shows how to set the dialog title and caption, and then check the entered text. ```java TInputBox box = inputBox("Input Box Window Title", "Caption above input field"); if (box.getText().equals("yes")) { ... the user entered "yes", do stuff ... } ``` -------------------------------- ### Create Casciian Window with Widgets Source: https://context7.com/crramirez/casciian/llms.txt Illustrates how to create a TWindow within a Casciian application, add labels and buttons to it, and define basic window management features. This example shows adding a label and a clickable button. ```java import casciian.TApplication; import casciian.TWindow; public class WindowExample extends TApplication { public WindowExample() throws Exception { super(BackendType.XTERM); // Create a window at position (5, 3) with size 40x15 TWindow window = addWindow("My Window", 5, 3, 40, 15); // Add widgets to the window window.addLabel("Hello, Casciian!", 2, 2); window.addButton("&Click Me", 2, 4, () -> { messageBox("Info", "Button clicked!"); }); addFileMenu(); } public static void main(String[] args) throws Exception { new WindowExample().run(); } } ``` -------------------------------- ### Periodic Actions with TTimer - Java Source: https://context7.com/crramirez/casciian/llms.txt Demonstrates the usage of TTimer to execute actions at specified intervals. This is ideal for implementing animations, periodic updates, or delayed operations. The example shows how to create both recurring and one-shot timers, and how to stop a timer. ```java import casciian.TTimer; import casciian.TAction; // Create a timer that fires every 100ms TTimer animationTimer = getApplication().addTimer(100, true, new TAction() { public void DO() { // Update animation frame updateAnimation(); getApplication().doRepaint(); } } ); // One-shot timer (fires once after 5 seconds) TTimer delayedAction = getApplication().addTimer(5000, false, new TAction() { public void DO() { showNotification("Timer elapsed!"); } } ); // Stop a timer animationTimer.setRecurring(false); ``` -------------------------------- ### TMessageBox: Display Modal Dialogs (Java) Source: https://context7.com/crramirez/casciian/llms.txt Provides examples of using TMessageBox to display modal dialogs with different button configurations (OK, Yes/No, OK/Cancel). Shows how to retrieve user responses. Requires casciian.TMessageBox. ```java import casciian.TMessageBox; // Simple OK message box messageBox("Information", "Operation completed successfully.", TMessageBox.Type.OK); // Yes/No confirmation dialog TMessageBox confirm = messageBox("Confirm", "Are you sure you want to delete?", TMessageBox.Type.YESNO); if (confirm.isYes()) { // User clicked Yes performDelete(); } // OK/Cancel dialog TMessageBox box = messageBox("Save Changes", "Do you want to save your changes?", TMessageBox.Type.OKCANCEL); if (box.isOk()) { saveChanges(); } ``` -------------------------------- ### Create and Configure TCalendar with Action Source: https://github.com/crramirez/casciian/wiki/widget-tcalendar Demonstrates how to create a TCalendar instance and associate a TAction with it. The action is executed when the user interacts with the calendar, displaying a message box with the selected date. This example requires the TAction interface and TMessageBox class. ```Java TCalendar calendar = addCalendar(x, y, new TAction() { public void DO() { messageBox("Calendar", "You selected " + calendar.getValue(), TMessageBox.Type.OK); } } ); ``` -------------------------------- ### Configure Casciian Behavior with System Properties - Java Source: https://context7.com/crramirez/casciian/llms.txt Explains how to customize Casciian's behavior and appearance by setting system properties before the application starts. This allows for fine-grained control over visual effects, window styles, and UI element visibility without modifying the core code. ```java public static void main(String[] args) throws Exception { // Visual effects System.setProperty("casciian.animations", "true"); System.setProperty("casciian.translucence", "true"); System.setProperty("casciian.shadowOpacity", "60"); // Window effects System.setProperty("casciian.effect.windowOpen", "fade"); System.setProperty("casciian.effect.windowClose", "burn"); // Window styles System.setProperty("casciian.TWindow.opacity", "95"); System.setProperty("casciian.TWindow.borderStyleForeground", "double"); System.setProperty("casciian.TWindow.borderStyleInactive", "single"); // Hide UI elements System.setProperty("casciian.hideMenuBar", "false"); System.setProperty("casciian.hideStatusBar", "false"); // Terminal settings System.setProperty("casciian.TTerminal.closeOnExit", "true"); System.setProperty("casciian.TTerminal.opacity", "90"); // Launch application MyApplication app = new MyApplication(); app.run(); } ``` -------------------------------- ### Loading Custom Help File in TApplication (Java) Source: https://github.com/crramirez/casciian/wiki/widget-thelpwindow Demonstrates how to load a custom help file into a TApplication subclass. It involves initializing a list of topics and a HelpFile object, then loading the XML content from a file input stream. This is typically done when setting up the application to use custom help text. ```Java helpTopics = new ArrayList(); helpFile = new HelpFile(); helpFile.load(new FileInputStream(filename)); ``` -------------------------------- ### Run Casciian Demo Applications - Bash Source: https://context7.com/crramirez/casciian/llms.txt Provides command-line instructions for running various Casciian demo applications. These demos showcase different features, including a comprehensive widget showcase, default settings, a Telnet server for multi-user support, BoxLayoutManager, and a MultiBackend demo for shared screens. ```bash # Main demo - comprehensive widget showcase java -jar casciian-demo.jar # Run with default settings (no enhanced visuals) java -jar casciian-demo.jar --defaults # Telnet server demo - multi-user support java -cp casciian-demo.jar demo.Demo2 8888 # Connect with: telnet localhost 8888 # BoxLayoutManager demo java -cp casciian-demo.jar demo.Demo7 # MultiBackend demo - shared screen for multiple users java -cp casciian-demo.jar demo.Demo8 8888 ``` -------------------------------- ### Run Casciian Demo2 (Telnet Server) Source: https://github.com/crramirez/casciian/wiki/demo-application Demonstrates Casciian's network capabilities by serving the UI over TCP as a multi-user telnet server. Each client receives their own DemoApplication instance and connection information is displayed. This shows how to build multi-user terminal applications. ```bash java -cp casciian-full.jar demo.Demo2 [port] # Connect with: telnet localhost [port] ``` -------------------------------- ### THelpWindow XML Text File Format Source: https://github.com/crramirez/casciian/wiki/widget-thelpwindow Defines the structure of an XML file used for THelpWindow help content. It includes metadata like name, author, version, and date, followed by a list of topics. Each topic has a title and text content, supporting inline markup for index entries and links to other topics. ```XML Casciian Help File Autumn Lamonte 1.0.0 Jan 1, 2020 This [window](Windows) does not have a specific help topic. See [here](Help On Help) for general information on using the help system. The #{help} system... Written 2013-2025 by Autumn Lamonte Dedicated to the public domain. ``` -------------------------------- ### Run Casciian Demo1 (Widget Showcase) Source: https://github.com/crramirez/casciian/wiki/demo-application Demonstrates the comprehensive suite of Casciian widgets and features. This is the default main class for the project and runs locally using the XTERM backend. It showcases various UI elements like message boxes, text fields, buttons, editors, tables, and more. ```bash java -jar casciian-full.jar # or with default settings (no enhanced visuals): java -jar casciian-full.jar --defaults ``` -------------------------------- ### Instantiate TEditorWindow in Java Source: https://github.com/crramirez/casciian/wiki/widget-teditorwindow Demonstrates how to create a new instance of the TEditorWindow class. This typically requires an application context or similar object to be passed to the constructor. ```java new TEditorWindow(getApplication()); ``` -------------------------------- ### Running the Casciian Demo Application Source: https://github.com/crramirez/casciian/wiki/Home This command executes the full Casciian demo application, which showcases all the features and widgets available in the library. This is a useful way to explore the library's capabilities. ```bash java -jar casciian-full.jar ``` -------------------------------- ### Create and Open TEditorWindow Source: https://context7.com/crramirez/casciian/llms.txt Demonstrates how to create a TEditorWindow, either as an empty editor or to open and edit a specific text file. ```java import casciian.TEditorWindow; // Open empty editor TEditorWindow editor = new TEditorWindow(getApplication()); // Open editor with a specific file TEditorWindow fileEditor = new TEditorWindow(getApplication(), "/path/to/file.txt"); ``` -------------------------------- ### Run Casciian Demo with Native Access (Java) Source: https://context7.com/crramirez/casciian/llms.txt This command executes the Casciian demo JAR file. The `--enable-native-access=ALL-UNNAMED` flag is often required for Windows users to grant necessary native access permissions for the application to function correctly. ```shell java --enable-native-access=ALL-UNNAMED -jar casciian-demo.jar ``` -------------------------------- ### Instantiate TEditDesktopStyleWindow in Java Source: https://github.com/crramirez/casciian/wiki/widget-teditdesktopstylewindow This Java code demonstrates how to create an instance of the TEditDesktopStyleWindow. It requires an application context to be passed during instantiation. This is typically used to open the dialog for style editing. ```java new TEditDesktopStyleWindow(getApplication()); ``` -------------------------------- ### Create Basic Casciian Application Source: https://context7.com/crramirez/casciian/llms.txt Demonstrates the creation of a basic Casciian application by extending the TApplication class. It initializes the application with an XTERM backend and sets up standard menus. ```java import casciian.TApplication; public class MyApplication extends TApplication { public MyApplication() throws Exception { super(BackendType.XTERM); // Create standard menus for Tool, File, and Window addToolMenu(); addFileMenu(); addWindowMenu(); } public static void main(String[] args) throws Exception { MyApplication app = new MyApplication(); app.run(); } } ``` -------------------------------- ### Initialize TVScroller in Java Source: https://github.com/crramirez/casciian/wiki/widget-tvscroller Demonstrates how to create an instance of the TVScroller class in Java. It requires the current context, scroll bar width, initial x-coordinate, and initial y-coordinate as parameters. ```Java TVScroller vScroller = new TVScroller(this, getWidth() - 2, 0, getHeight() - 2); ``` -------------------------------- ### Open TTerminalWindow and Configure Settings Source: https://context7.com/crramirez/casciian/llms.txt Shows how to open a new terminal window using the default shell and how to configure terminal behavior, such as closing on exit, opacity, and scrollback buffer size, using system properties. ```java // Open a new terminal window with default shell getApplication().openTerminal(); // Terminal settings via system properties System.setProperty("casciian.TTerminal.closeOnExit", "true"); System.setProperty("casciian.TTerminal.opacity", "90"); System.setProperty("casciian.TTerminal.scrollbackMax", "5000"); ``` -------------------------------- ### Java BoxLayoutManager Example: Horizontal and Vertical Layout Source: https://github.com/crramirez/casciian/wiki/layout-box This Java code demonstrates the usage of BoxLayoutManager to create a window with two panels. The main window uses a horizontal BoxLayoutManager, while each panel uses a vertical BoxLayoutManager to arrange text widgets. It initializes a TWindow, sets its layout manager, and adds TPanels and TText widgets. ```Java TWindow window = new TWindow(app, "BoxLayoutManager Demo", 60, 22); window.setLayoutManager(new BoxLayoutManager(window.getWidth() - 2, window.getHeight() - 2, false)); TPanel right = window.addPanel(0, 0, 10, 10); TPanel left = window.addPanel(0, 0, 10, 10); right.setLayoutManager(new BoxLayoutManager(right.getWidth(), right.getHeight(), true)); left.setLayoutManager(new BoxLayoutManager(left.getWidth(), left.getHeight(), true)); left.addText("C1", 0, 0, left.getWidth(), left.getHeight()); left.addText("C2", 0, 0, left.getWidth(), left.getHeight()); left.addText("C3", 0, 0, left.getWidth(), left.getHeight()); right.addText("C4", 0, 0, right.getWidth(), right.getHeight()); right.addText("C5", 0, 0, right.getWidth(), right.getHeight()); right.addText("C6", 0, 0, right.getWidth(), right.getHeight()); ``` -------------------------------- ### Instantiate TEditColorThemeWindow in Java Source: https://github.com/crramirez/casciian/wiki/widget-teditcolorthemewindow This Java code snippet demonstrates how to create a new instance of the TEditColorThemeWindow. It requires an application context to be passed during instantiation. This is typically used to launch the color theme editing dialog. ```Java new TEditColorThemeWindow(getApplication()); ``` -------------------------------- ### Instantiate TTerminalInformationWindow in Java Source: https://github.com/crramirez/casciian/wiki/widget-tterminalinformationwindow This Java code snippet demonstrates how to create an instance of the TTerminalInformationWindow class. It requires an application context to be passed during instantiation. This is typically used to display the information dialog to the user. ```java new TTerminalInformationWindow(getApplication()); ``` -------------------------------- ### Run Casciian Demo8 (MultiBackend and MultiScreen) Source: https://github.com/crramirez/casciian/wiki/demo-application Showcases advanced multi-user capabilities with MultiBackend and MultiScreen functionality. This demo runs as a headless application with multiple telnet connections, where all users share the same DemoApplication instance. It demonstrates building shared, collaborative terminal applications. ```bash java -cp casciian-full.jar demo.Demo8 [port] # Multiple users can connect simultaneously via telnet ``` -------------------------------- ### Implement TButton Widget in Casciian Source: https://context7.com/crramirez/casciian/llms.txt Shows how to create and use a TButton widget in Casciian, including setting its label, position, and defining an action to be performed when clicked. It also demonstrates programmatic dispatching of the button's action. ```java import casciian.TAction; import casciian.TButton; // Add a button with mnemonic Alt-M TButton button = addButton("&MessageBoxes", 10, 5, new TAction() { public void DO() { messageBox("Title", "Button was clicked!", TMessageBox.Type.OK); } } ); // Button can also be dispatched programmatically button.dispatch(); ``` -------------------------------- ### TList: Create Scrollable String List with Actions (Java) Source: https://context7.com/crramirez/casciian/llms.txt Shows how to create a TList, a scrollable list of strings. It covers adding items and defining actions for single clicks, double-clicks/Enter, and keyboard navigation. Requires casciian.TList, casciian.TAction, and java.util.List. ```java import casciian.TList; import casciian.TAction; import java.util.ArrayList; import java.util.List; List items = new ArrayList<>(); items.add("Item 1"); items.add("Item 2"); items.add("Item 3"); // Add list at position (5, 3) with size 20x8 TList list = addList(items, 5, 3, 20, 8, new TAction() { public void DO() { // Called on Enter or double-click String selected = list.getSelectedString(); messageBox("Selected", selected, TMessageBox.Type.OK); } }, new TAction() { public void DO() { // Called on single click } }, new TAction() { public void DO() { // Called on keyboard navigation } } ); ``` -------------------------------- ### Displaying a TMessageBox with OK/Cancel Buttons (Java) Source: https://github.com/crramirez/casciian/wiki/widget-tmessagebox Demonstrates how to create and display a TMessageBox with OK and Cancel buttons, and how to check the user's selection. This method is useful for simple confirmation dialogs. ```Java TMessageBox box = messageBox(title, caption, TMessageBox.Type.OK | TMessageBox.Type.CANCEL); if (box.getResult() == TMessageBox.OK) { // ... the user pressed OK, do stuff ... } ``` ```Java if (messageBox(title, caption, TMessageBox.Type.OK | TMessageBox.Type.CANCEL).isOk()) { // ... the user pressed OK, do stuff ... } ``` -------------------------------- ### Global Application Settings Source: https://github.com/crramirez/casciian/wiki/System-Properties Configure global application-level settings that affect the overall behavior and appearance. ```APIDOC ## Global Application Settings ### Description Properties that control global application behavior, such as menu visibility, status bar, and mouse pointer. ### Method N/A (Configuration Properties) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ## Properties - **casciian.hideMenuBar** (boolean) - Used by `casciian.TApplication`. If true, do not display the pull-down menu on the top row. Menu keyboard accelerators will still work. Default: `false`. - **casciian.hideStatusBar** (boolean) - Used by `casciian.TApplication`. If true, do not display the status bar on the bottom row. Status bar keyboard accelerators will still work. Default: `false`. - **casciian.hideMouseWhenTyping** (boolean) - Used by `casciian.TApplication`. If true, suppress the text-based mouse pointer after a user presses a key. Mouse motion will restore the pointer. Default: `false`. - **casciian.textMouse** (boolean) - Used by `casciian.TApplication`. If true, display a text-based mouse pointer, otherwise do not. Default: `true`. - **casciian.menuIcons** (boolean) - Used by `casciian.TApplication`. If true, show icons at the left of menu labels if defined. Icons are usually emoticons. Default: `false`. - **casciian.menuIconsOffset** (integer) - Used by `casciian.TApplication`. Number of spaces to move the label to the right to accommodate icons when `casciian.menuIcons` is enabled. Valid range: 0-5 (values outside this range will be clamped). Default: `3`. - **casciian.useJline** (boolean) - Used by `casciian.backend.ECMA48Terminal`. On non-Windows platforms, when this property is true, use the JLine library for raw/cooked mode instead of relying on stty commands. On Windows, JLine is always used for proper Unicode support, regardless of this property's value. Default: `false` (use stty commands on Unix-like systems; always use JLine on Windows). - **casciian.useTerminalPalette** (boolean) - Used by `casciian.backend.ECMA48Terminal`. When set to true, Casciian will use the terminal's native palette instead of CGA colors. Default: `false`. ``` -------------------------------- ### Add Window to Application (Java) Source: https://github.com/crramirez/casciian/wiki/widget-twindow Demonstrates how to add a new window to the TApplication. This method requires the window's title, its initial position (x, y coordinates), and its dimensions (width, height). ```Java application.addWindow("Window title", x, y, width, height); ``` -------------------------------- ### Widget Styles Properties Source: https://github.com/crramirez/casciian/wiki/System-Properties Configure the styles for various UI widgets like buttons, menus, and panels. ```APIDOC ## Widget Styles Properties ### Description Properties to configure the visual styles of various UI widgets within the application. ### Method N/A (Configuration Properties) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ## Properties - **casciian.TButton.style** (string) - Default: `square` - Button style. - **casciian.TMenu.borderStyle** (string) - Default: `single` - Menu border style. - **casciian.TMenu.opacity** (integer) - Default: `95` - Menu window opacity (10 - 100). - **casciian.TPanel.borderStyle** (string) - Default: `none` - TPanel border style. - **casciian.TRadioGroup.borderStyle** (string) - Default: `singleVdoubleH` - Radio group border style. - **casciian.TEditColorTheme.borderStyle** (string) - Default: `double` - Color theme window border style. - **casciian.TEditColorTheme.options.borderStyle** (string) - Default: `single` - Interior boxes border style. ``` -------------------------------- ### Create Status Bar with Shortcuts - Java Source: https://context7.com/crramirez/casciian/llms.txt Demonstrates how to create a TStatusBar for a window and add clickable shortcut keypresses with associated commands and labels. This is useful for providing quick access to common actions within an application window. ```java import casciian.TStatusBar; import static casciian.TCommand.*; import static casciian.TKeypress.*; // Create status bar for a window TStatusBar statusBar = newStatusBar("Editor");statusBar.addShortcutKeypress(kbF1, cmHelp, "Help");statusBar.addShortcutKeypress(kbF2, cmSave, "Save");statusBar.addShortcutKeypress(kbF3, cmOpen, "Open");statusBar.addShortcutKeypress(kbF10, cmMenu, "Menu"); ``` -------------------------------- ### TFileOpenBox: Create File Selection Dialogs (Java) Source: https://context7.com/crramirez/casciian/llms.txt Illustrates the use of TFileOpenBox for displaying file browser dialogs. Covers both opening and saving files, showing how to specify initial paths and retrieve selected filenames. Requires casciian.TFileOpenBox. ```java import casciian.TFileOpenBox; // Open file dialog String filename = fileOpenBox("/home/user", TFileOpenBox.Type.OPEN); if (filename != null) { openFile(filename); } // Save file dialog String savePath = fileOpenBox("/home/user/document.txt", TFileOpenBox.Type.SAVE); if (savePath != null) { saveFile(savePath); } ``` -------------------------------- ### Add Shortcut Keypresses to TStatusBar (Java) Source: https://github.com/crramirez/casciian/wiki/widget-tstatusbar Demonstrates how to add shortcut keypresses to a TStatusBar instance. This allows users to trigger specific commands by pressing defined function keys. Requires the TStatusBar object and command constants. ```Java statusBar = newStatusBar("Editor"); statusBar.addShortcutKeypress(kbF1, cmHelp, "Help"); statusBar.addShortcutKeypress(kbF2, cmSave, "Save"); statusBar.addShortcutKeypress(kbF3, cmOpen, "Open"); statusBar.addShortcutKeypress(kbF10, cmMenu, "Menu"); ``` -------------------------------- ### TInputBox: Create Text Input Dialog (Java) Source: https://context7.com/crramirez/casciian/llms.txt Demonstrates how to use TInputBox to display a modal dialog with a text field for user input. Shows how to retrieve the entered text and perform actions based on it. Requires casciian.TInputBox. ```java import casciian.TInputBox; // Show input dialog and get result TInputBox input = inputBox("New File", "Enter filename:"); String filename = input.getText(); if (filename != null && !filename.isEmpty()) { createFile(filename); } ``` -------------------------------- ### Create and Update TProgressBar Source: https://context7.com/crramirez/casciian/llms.txt Demonstrates how to create a TProgressBar at a specific position and size, update its value to visualize task progress, and set custom minimum and maximum values. ```java import casciian.TProgressBar; // Create progress bar at (10, 5) with width 40, starting at 0% TProgressBar progressBar = addProgressBar(10, 5, 40, 0); // Update progress in a loop for (int i = 0; i <= 100; i++) { progressBar.setValue(i); getApplication().doRepaint(); Thread.sleep(50); } // Custom min/max values TProgressBar customProgress = addProgressBar(10, 7, 40, 0); customProgress.setMinValue(0); customProgress.setMaxValue(1000); customProgress.setValue(350); // 35% complete ``` -------------------------------- ### Create TTreeViewWindow with Project Data (Java) Source: https://github.com/crramirez/casciian/wiki/widget-ttreeview Shows the creation of a TTreeViewWindow, a class that extends TTreeViewWindow, to display project-related data. It initializes the window, loads tree items from project targets, and reflows the data. ```Java public class ProjectWindow extends TTreeViewWindow { private ProjectWindowTreeItem root; public ProjectWindow(final TApplication parent, final Project project) { super(parent, i18n.getString("windowTitle"), project.getWindowLeft(), project.getWindowTop() - 1, project.getWindowWidth(), project.getWindowHeight(), RESIZABLE | ABSOLUTEXY, null); // Load the treeview root = new ProjectWindowTreeItem(this, project); for (Target target: project.getTargets()) { root.addChildTarget(this, target); } reflowData(); } } ``` -------------------------------- ### Add TTreeView Widget and Directory Item (Java) Source: https://github.com/crramirez/casciian/wiki/widget-ttreeview Demonstrates how to add a TTreeView widget to a UI and initialize it with a directory tree item. This is useful for displaying file system structures or hierarchical data. ```Java treeView = addTreeViewWidget(x, y, width, height); new TDirectoryTreeItem(treeView, ".", true); ``` -------------------------------- ### Add TLabel in Java Source: https://github.com/crramirez/casciian/wiki/widget-tlabel Demonstrates how to add a TLabel to a UI. This function likely takes the text to display and its position as arguments. No specific dependencies are mentioned, but it's assumed to be part of a larger UI framework. ```Java addLabel("Something to say", x, y); ``` -------------------------------- ### TComboBox: Create Dropdown with Text Input (Java) Source: https://context7.com/crramirez/casciian/llms.txt Illustrates the creation of a TComboBox, which combines a text field with a dropdown list. It shows how to populate options and attach an action listener for selection events. Requires casciian.TComboBox, casciian.TAction, and java.util.List. ```java import casciian.TComboBox; import casciian.TAction; import java.util.ArrayList; import java.util.List; List options = new ArrayList<>(); options.add("Option 1"); options.add("Option 2"); options.add("Option 3"); // Create combobox at (10, 5), width 15, showing 2-6 items in dropdown TComboBox comboBox = addComboBox(10, 5, 15, options, 2, 6, new TAction() { public void DO() { String selected = comboBox.getText(); messageBox("Selection", "You chose: " + selected, TMessageBox.Type.OK); } } ); ``` -------------------------------- ### Proportional Resizing with StretchLayoutManager - Java Source: https://context7.com/crramirez/casciian/llms.txt Shows how to use StretchLayoutManager to maintain relative widget positions and sizes when a window is resized. Widgets added with this layout manager will scale proportionally to the available space, ensuring a consistent user experience across different window dimensions. ```java import casciian.TWindow; import casciian.layout.StretchLayoutManager; TWindow window = addWindow("Stretch Demo", 5, 3, 60, 20); // Enable stretch layout - widgets will scale proportionally window.setLayoutManager(new StretchLayoutManager( window.getWidth() - 2, window.getHeight() - 2)); // Add widgets at fixed positions - they'll stretch on resize window.addLabel("Name:", 2, 2); window.addField(12, 2, 40, false, ""); window.addLabel("Email:", 2, 4); window.addField(12, 4, 40, false, ""); window.addButton("&Submit", 25, 8, () -> submitForm()); ``` -------------------------------- ### Open File with TFileOpenBox in Java Source: https://github.com/crramirez/casciian/wiki/widget-tfileopenbox Demonstrates how to use TFileOpenBox to prompt the user to select a file for opening. It returns the selected filename or null if the dialog is cancelled. Ensure TFileOpenBox is correctly initialized and available in your environment. ```Java filename = fileOpenBox("/path/to/file.ext", TFileOpenBox.Type.OPEN); if (filename != null) { // ... the user selected a file, go open it ... } ``` -------------------------------- ### Maven and Gradle Dependencies for Casciian Source: https://context7.com/crramirez/casciian/llms.txt Instructions for adding the Casciian library to your project using either Maven or Gradle build tools. This ensures the library is available for use in your Java application. ```xml io.github.crramirez casciian 1.4.0 ``` ```gradle // Gradle implementation 'io.github.crramirez:casciian:1.4.0' ``` -------------------------------- ### Create TPanel Container in Java Source: https://github.com/crramirez/casciian/wiki/widget-tpanel This snippet demonstrates how to create an instance of the TPanel widget using the addPanel method. TPanel acts as an empty container for other widgets, facilitating layout organization. The method requires coordinates (x, y) and dimensions (width, height) to define the panel's position and size. ```Java TPanel left = addPanel(x, y, width, height); ``` -------------------------------- ### TRadioGroup: Create and Manage Mutually Exclusive Options (Java) Source: https://context7.com/crramirez/casciian/llms.txt Demonstrates how to create a TRadioGroup, add radio buttons with pre-selection, and retrieve the selected option's index or text. Requires the casciian.TRadioGroup class. ```java import casciian.TRadioGroup; // Create a radio group at position (5, 3) TRadioGroup colorGroup = addRadioGroup(5, 3, "Select Color"); colorGroup.addRadioButton("Red"); colorGroup.addRadioButton("Green", true); // Pre-selected colorGroup.addRadioButton("Blue"); colorGroup.setRequiresSelection(true); // Get selected index (0-based) int selectedIndex = colorGroup.getSelectedIndex(); // Get selected button text String selectedColor = colorGroup.getSelected().getMnemonic().getRawLabel(); ``` -------------------------------- ### Create TCalendar with Date Selection Action Source: https://context7.com/crramirez/casciian/llms.txt Shows how to instantiate a TCalendar widget and attach an action listener to handle date selection events, displaying the selected date in a message box. ```java import casciian.TCalendar; import casciian.TAction; import java.util.Calendar; TCalendar calendar = addCalendar(5, 3, new TAction() { public void DO() { Calendar selected = calendar.getValue(); int year = selected.get(Calendar.YEAR); int month = selected.get(Calendar.MONTH) + 1; int day = selected.get(Calendar.DAY_OF_MONTH); messageBox("Date Selected", String.format("%d/%d/%d", month, day, year), TMessageBox.Type.OK); } } ); ``` -------------------------------- ### Create TDirectoryList in Java Source: https://github.com/crramirez/casciian/wiki/widget-tdirectorylist This Java code demonstrates how to create and configure a TDirectoryList component. It takes the directory path, position, dimensions, and two TAction objects for handling double-click/Enter and single-click events, along with optional filters. The TAction objects define the behavior executed upon user interaction. ```java TDirectoryList list = addDirectoryList(path, x, y, width, height, new TAction() { public void DO() { // The action to perform when the user presses Enter // or double-clicks an item in this list. } }, new TAction() { public void DO() { // The action to perform when the user single-clicks // an item in this list. } }, filters); ``` -------------------------------- ### Implement TField Text Input in Casciian Source: https://context7.com/crramirez/casciian/llms.txt Demonstrates the usage of the TField widget for text input in Casciian. It covers creating a basic text field and a field with associated actions for enter key presses and text changes. ```java import casciian.TField; import casciian.TAction; // Add a text field at position (10, 5) with width 20 TField nameField = addField(10, 5, 20, false, "Default text"); // Field with enter action TField searchField = addField(10, 7, 25, false, "", new TAction() { public void DO() { String searchTerm = searchField.getText(); // Perform search... } }, new TAction() { public void DO() { // Called when text changes System.out.println("Current text: " + searchField.getText()); } } ); ```