Class EditableLabel

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Editable, Proxy

@Generated("org.javagi.JavaGI") public class EditableLabel extends Widget implements Accessible, Buildable, ConstraintTarget, Editable

Allows users to edit the displayed text by switching to an “edit mode”.

An example GtkEditableLabel

GtkEditableLabel does not have API of its own, but it implements the Editable interface.

The default bindings for activating the edit mode is to click or press the Enter key. The default bindings for leaving the edit mode are the Enter key (to save the results) or the Escape key (to cancel the editing).

Shortcuts and Gestures

GtkEditableLabel supports the following keyboard shortcuts:

  • Enter starts editing.
  • Escape stops editing.

Actions

GtkEditableLabel defines a set of built-in actions:

  • editing.starts switches the widget into editing mode.
  • editing.stop switches the widget out of editing mode.

CSS nodes

editablelabel[.editing]
╰── stack
    ├── label
    ╰── text

GtkEditableLabel has a main node with the name editablelabel. When the entry is in editing mode, it gets the .editing style class.

For all the subnodes added to the text node in various situations, see Text.

  • Constructor Details

    • EditableLabel

      public EditableLabel(MemorySegment address)
      Create a EditableLabel instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • EditableLabel

      public EditableLabel(String str)
      Creates a new GtkEditableLabel widget.
      Parameters:
      str - the text for the label
    • EditableLabel

      public EditableLabel()
      Create a new EditableLabel.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the EditableLabel class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected EditableLabel asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Widget
      Returns:
      the instance as if it were its parent type
    • getEditing

      public boolean getEditing()
      Returns whether the label is currently in “editing mode”.
      Returns:
      true if this EditableLabel is currently in editing mode
    • startEditing

      public void startEditing()
      Switches the label into “editing mode”.
    • stopEditing

      public void stopEditing(boolean commit)

      Switches the label out of “editing mode”.

      If commit is true, the resulting text is kept as the Gtk.Editable:text property value, otherwise the resulting text is discarded and the label will keep its previous Gtk.Editable:text property value.

      Parameters:
      commit - whether to set the edited text on the label
    • builder

      public static EditableLabel.Builder<? extends EditableLabel.Builder> builder()
      A EditableLabel.Builder object constructs a EditableLabel with the specified properties. Use the various set...() methods to set properties, and finish construction with EditableLabel.Builder.build().
      Returns:
      the builder object