java.lang.Object
com.dua3.utility.fx.controls.Controls

public final class Controls extends Object
Utility class for creating and managing UI controls.
  • Methodendetails

    • button

      public static ButtonBuilder<Button> button()
      Create ButtonBuilder instance for standard buttons.
      Gibt zurück:
      new ButtonBuilder
    • toggleButton

      public static ToggleButtonBuilder toggleButton()
      Create ButtonBuilder instance for toggle buttons.
      Gibt zurück:
      new ButtonBuilder
    • toggleButton

      public static ToggleButtonBuilder toggleButton(boolean selected)
      Create ButtonBuilder instance for toggle buttons.
      Parameter:
      selected - the initial selection state of the button
      Gibt zurück:
      new ButtonBuilder
    • checkbox

      public static CheckBoxButtonBuilder checkbox()
      Create ButtonBuilder instance for checkboxes.
      Gibt zurück:
      new ButtonBuilder
    • checkbox

      public static CheckBoxButtonBuilder checkbox(boolean selected)
      Create ButtonBuilder instance for checkboxes.
      Parameter:
      selected - the initial selection state of the button
      Gibt zurück:
      new ButtonBuilder
    • fileInput

      public static FileInputBuilder fileInput(FileDialogMode mode)
      Creates a new FileInputBuilder instance with the given mode.
      Parameter:
      mode - the FileDialogMode of the file dialog
      Gibt zurück:
      a new FileInputBuilder instance
    • slider

      public static SliderBuilder slider()
      Create SliderBuilder instance.
      Gibt zurück:
      new SliderBuilder
    • slider

      public static SliderBuilder slider(SliderWithButtons.Mode mode, BiFunction<Double,Double,String> formatter)
      Create SliderBuilder instance.
      Parameter:
      mode - the SliderWithButtons.Mode
      formatter - the formatter that generates the label text; first argument is current value and second is max value
      Gibt zurück:
      new SliderBuilder
    • separator

      public static Node separator(Orientation orientation)
      Create Separator.
      Parameter:
      orientation - the separator orientation
      Gibt zurück:
      new Separator
    • graphic

      public static Node graphic(String name)
      Get graphic for an icon by icon name.
      Parameter:
      name - the icon name
      Gibt zurück:
      a node for the graphic
      Löst aus:
      IllegalStateException - if no icon with a matching name is found
      Siehe auch:
      • IconUtil.iconFromName(String)
    • icon

      public static com.dua3.utility.fx.icons.Icon icon(String name)
      Get icon by name.
      Parameter:
      name - the icon name
      Gibt zurück:
      icon
      Löst aus:
      IllegalStateException - if no icon with a matching name is found
      Siehe auch:
      • IconUtil.iconFromName(String)
    • rigidLabel

      public static Label rigidLabel(String text)
      Create a fixed minimum width label with the given text to prevent an ellipsis being displayed.
      Parameter:
      text - the text to display on the label
      Gibt zurück:
      a new Label instance with fixed miimum width
      Siehe auch:
    • rigidLabel

      public static Label rigidLabel(String text, Node node)
      Create a fixed minimum width label with the given text to prevent an ellipsis being display.
      Parameter:
      text - the text to display on the label
      node - the node to display on the label
      Gibt zurück:
      a new Label instance with fixed miimum width
      Siehe auch:
    • graphic

      public static Node graphic(String name, int size)
      Get graphic for an icon by icon name.
      Parameter:
      name - the icon name
      size - the requested size
      Gibt zurück:
      a node for the graphic
      Löst aus:
      IllegalStateException - if no icon with a matching name is found
      Siehe auch:
      • IconUtil.iconFromName(String)
    • graphic

      public static Node graphic(String name, int size, Paint paint)
      Get graphic for an icon by icon name.
      Parameter:
      name - the icon name
      size - the requested size
      paint - the Paint to use
      Gibt zurück:
      a node for the graphic
      Löst aus:
      IllegalStateException - if no icon with a matching name is found
      Siehe auch:
      • IconUtil.iconFromName(String)
    • graphic

      public static Node graphic(String name, int size, com.dua3.utility.data.Color color)
      Get graphic for an icon by icon name.
      Parameter:
      name - the icon name
      size - the requested size
      color - the Color to use
      Gibt zurück:
      a node for the graphic
      Löst aus:
      IllegalStateException - if no icon with a matching name is found
      Siehe auch:
      • IconUtil.iconFromName(String)
    • tooltipIcon

      public static Node tooltipIcon(String name, int size, Paint paint, String tooltipText)
      Create an Icon with a tooltip.
      Parameter:
      name - the icon name
      size - the requested size
      paint - the Paint to use
      tooltipText - the text to display as tooltip
      Gibt zurück:
      a node for the graphic
      Löst aus:
      IllegalStateException - if no icon with a matching name is found
      Siehe auch:
      • IconUtil.iconFromName(String)
    • tooltipIcon

      public static Node tooltipIcon(String name, int size, com.dua3.utility.data.Color color, String tooltipText)
      Create an Icon with a tooltip.
      Parameter:
      name - the icon name
      size - the requested size
      color - the Color to use
      tooltipText - the text to display as tooltip
      Gibt zurück:
      a node for the graphic
      Löst aus:
      IllegalStateException - if no icon with a matching name is found
      Siehe auch:
      • IconUtil.iconFromName(String)
    • textField

      public static TextFieldBuilder textField(Locale locale)
      Get TextFieldBuilder for creating a TextField.
      Gibt zurück:
      TextFieldBuilder instance
    • makeResizable

      public static void makeResizable(Region region, Position... borders)
      Make a region resizable by dragging its edge.
      Parameter:
      region - the region
      borders - the borders to make draggable
    • makeResizable

      public static void makeResizable(Region region, int resizeMargin, Position... borders)
      Make a region resizable by dragging its edge.
      Parameter:
      region - the region
      resizeMargin - size of the draggable margin
      borders - the borders to make draggable
    • checkMenuItem

      public static CheckMenuItem checkMenuItem(String text, Consumer<Boolean> action, boolean selected)
      Create new CheckMenuItem.
      Parameter:
      text - the text to show
      action - the action to perform when the menu item is invoked
      Gibt zurück:
      new menu item
    • checkMenuItem

      public static CheckMenuItem checkMenuItem(@Nullable String text, @Nullable Node graphic, Consumer<Boolean> action, boolean selected)
      Create new CheckMenuItem.
      Parameter:
      text - the text to show
      graphic - the graphic to show before the text
      action - the action to perform when the menu item is invoked
      Gibt zurück:
      new menu item
    • checkMenuItem

      public static CheckMenuItem checkMenuItem(String text, Property<Boolean> selected)
      Create new CheckMenuItem.
      Parameter:
      text - the text to show
      selected - the property controlling the selected state
      Gibt zurück:
      new menu item
    • checkMenuItem

      public static CheckMenuItem checkMenuItem(@Nullable String text, @Nullable Node graphic, Property<Boolean> selected)
      Create new CheckMenuItem.
      Parameter:
      text - the text to show
      graphic - the graphic to show before the text
      selected - the property controlling the selected state
      Gibt zurück:
      new menu item
    • checkMenuItem

      public static CheckMenuItem checkMenuItem(String text, Property<Boolean> selected, ObservableBooleanValue enabled)
      Create new CheckMenuItem.
      Parameter:
      text - the text to show
      selected - the property controlling the selected state
      enabled - the property controlling the enabled state
      Gibt zurück:
      new menu item
    • checkMenuItem

      public static CheckMenuItem checkMenuItem(String text, Property<Boolean> selected, boolean enabled)
      Create new CheckMenuItem.

      NOTE: the enabled state is permanent. Use this method only for menus where the menu state will not be changed, for example, in context menus. If the state is dynamic, use the overload taking an ObservableBooleanValue instead.

      Parameter:
      text - the text to show
      selected - the property controlling the selected state
      enabled - the enabled state
      Gibt zurück:
      new menu item
    • checkMenuItem

      public static CheckMenuItem checkMenuItem(@Nullable String text, @Nullable Node graphic, Property<Boolean> selected, ObservableBooleanValue enabled)
      Create new CheckMenuItem.
      Parameter:
      text - the text to show
      graphic - the graphic to show before the text
      selected - the property controlling the selected state
      enabled - the property controlling the enabled state
      Gibt zurück:
      new menu item
    • checkMenuItem

      public static CheckMenuItem checkMenuItem(@Nullable String text, @Nullable Node graphic, Property<Boolean> selected, boolean enabled)
      Create new CheckMenuItem.

      NOTE: the enabled state is permanent. Use this method only for menus where the menu state will not be changed, for example, in context menus. If the state is dynamic, use the overload taking an ObservableBooleanValue instead.

      Parameter:
      text - the text to show
      graphic - the graphic to show before the text
      selected - the property controlling the selected state
      enabled - the enabled state
      Gibt zurück:
      new menu item
    • text

      public static TextBuilder text(String text)
      Creates and returns a new instance of TextBuilder.
      Gibt zurück:
      a new instance of TextBuilder.
    • text

      public static TextBuilder text(ObservableValue<String> text)
      Creates and returns a new instance of TextBuilder.
      Gibt zurück:
      a new instance of TextBuilder.
    • label

      public static LabelBuilder label(String text)
      Creates and returns a new instance of LabelBuilder.
      Gibt zurück:
      a new instance of LabelBuilder.
    • label

      public static LabelBuilder label(ObservableValue<String> text)
      Creates and returns a new instance of LabelBuilder.
      Gibt zurück:
      a new instance of LabelBuilder.
    • background

      public static Background background(com.dua3.utility.data.Color color)