Interface Widget
- All Superinterfaces:
Binding
- All Known Implementing Classes:
ConsoleEngine.WidgetCreator
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Widgets are the fundamental building blocks of the line editor's functionality. Each widget implements a specific editing action or command that can be invoked by the user through key bindings. Examples include moving the cursor, deleting characters, searching history, and completing words.
Widgets can be bound to key sequences using the LineReader's key maps. When the
user presses a key sequence that is bound to a widget, the widget's apply()
method is called to perform the associated action.
JLine provides a set of built-in widgets that implement common editing functions, and applications can define custom widgets to extend the editor's functionality.
This interface is designed as a functional interface, making it easy to implement widgets using lambda expressions.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionboolean
apply()
Executes the action associated with this widget.
-
Method Details
-
apply
boolean apply()Executes the action associated with this widget.This method is called when the key sequence bound to this widget is pressed. It should perform the widget's specific editing action or command.
- Returns:
- true if the widget was successfully applied, false otherwise
-