java.lang.Object
com.ultikits.ultitools.abstracts.gui.declarative.core.Widget
com.ultikits.ultitools.abstracts.gui.declarative.widgets.Container

public class Container extends Widget
Container 是一个可以包含多个子 Widget 的容器。

它负责:

  • 管理子 Widget 列表
  • 为子 Widget 分配槽位
  • 支持背景填充

使用示例:


 Container.builder()
     .child(ItemDisplay.builder(item).build())
     .child(TextButton.builder().text("Click").build())
     .background(backgroundIcon)
     .build();
 
Since:
6.2.0
Version:
1.0.0
Author:
UltiTools Team
  • Field Details

    • children

      @NotNull private final @NotNull List<Widget> children
    • background

      @Nullable private final @Nullable IconWrapper background
  • Constructor Details

  • Method Details

    • builder

      @NotNull public static @NotNull Container.Builder builder()
      创建一个新的 Builder。
      Returns:
      Builder
    • getChildren

      @NotNull public @NotNull List<Widget> getChildren()
    • getBackground

      @Nullable public @Nullable IconWrapper getBackground()
    • createElement

      @NotNull public @NotNull Element createElement()
      Description copied from class: Widget
      为此 Widget 创建对应的 Element。

      这是框架内部使用的方法,子类应该根据 Widget 类型返回适当的 Element 实现。

      Specified by:
      createElement in class Widget
      Returns:
      对应的 Element 实例