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

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

    • button

      public static ButtonBuilder<Button> button()
      Create ButtonBuilder instance for standard buttons.
      Returns:
      new ButtonBuilder
    • toggleButton

      public static ButtonBuilder<ToggleButton> toggleButton()
      Create ButtonBuilder instance for toggle buttons.
      Returns:
      new ButtonBuilder
    • toggleButton

      public static ButtonBuilder<ToggleButton> toggleButton(boolean selected)
      Create ButtonBuilder instance for toggle buttons.
      Parameters:
      selected - the initial selection state of the button
      Returns:
      new ButtonBuilder
    • checkbox

      public static ButtonBuilder<CheckBox> checkbox()
      Create ButtonBuilder instance for checkboxes.
      Returns:
      new ButtonBuilder
    • checkbox

      public static ButtonBuilder<CheckBox> checkbox(boolean selected)
      Create ButtonBuilder instance for checkboxes.
      Parameters:
      selected - the initial selection state of the button
      Returns:
      new ButtonBuilder
    • fileInput

      public static FileInputBuilder fileInput(FileDialogMode mode)
      Creates a new FileInputBuilder instance with the given mode.
      Parameters:
      mode - the FileDialogMode of the file dialog
      Returns:
      a new FileInputBuilder instance
    • slider

      public static SliderBuilder slider()
      Create SliderBuilder instance.
      Returns:
      new SliderBuilder
    • slider

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

      public static Node separator(Orientation orientation)
      Create Separator.
      Parameters:
      orientation - the separator orientation
      Returns:
      new Separator
    • graphic

      public static Node graphic(String name)
      Get graphic for an icon by icon name.
      Parameters:
      name - the icon name
      Returns:
      a node for the graphic
      Throws:
      IllegalStateException - if no icon with a matching name is found
      See Also:
      • IconUtil.iconFromName(String)
    • icon

      public static com.dua3.utility.fx.icons.Icon icon(String name)
      Get icon by name.
      Parameters:
      name - the icon name
      Returns:
      icon
      Throws:
      IllegalStateException - if no icon with a matching name is found
      See Also:
      • 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 display.
      Parameters:
      text - the text to display on the label
      Returns:
      a new Label instance with fixed miimum width
      See Also:
    • 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.
      Parameters:
      text - the text to display on the label
      node - the node to display on the label
      Returns:
      a new Label instance with fixed miimum width
      See Also:
    • graphic

      public static Node graphic(String name, int size)
      Get graphic for an icon by icon name.
      Parameters:
      name - the icon name
      size - the requested size
      Returns:
      a node for the graphic
      Throws:
      IllegalStateException - if no icon with a matching name is found
      See Also:
      • IconUtil.iconFromName(String)
    • graphic

      public static Node graphic(String name, int size, Paint paint)
      Get graphic for an icon by icon name.
      Parameters:
      name - the icon name
      size - the requested size
      paint - the Paint to use
      Returns:
      a node for the graphic
      Throws:
      IllegalStateException - if no icon with a matching name is found
      See Also:
      • 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.
      Parameters:
      name - the icon name
      size - the requested size
      color - the Color to use
      Returns:
      a node for the graphic
      Throws:
      IllegalStateException - if no icon with a matching name is found
      See Also:
      • IconUtil.iconFromName(String)
    • tooltipIcon

      public static Node tooltipIcon(String name, int size, Paint paint, String tooltipText)
      Create an Icon with a tooltip.
      Parameters:
      name - the icon name
      size - the requested size
      paint - the Paint to use
      tooltipText - the text to display as tooltip
      Returns:
      a node for the graphic
      Throws:
      IllegalStateException - if no icon with a matching name is found
      See Also:
      • 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.
      Parameters:
      name - the icon name
      size - the requested size
      color - the Color to use
      tooltipText - the text to display as tooltip
      Returns:
      a node for the graphic
      Throws:
      IllegalStateException - if no icon with a matching name is found
      See Also:
      • IconUtil.iconFromName(String)
    • textField

      public static TextFieldBuilder textField()
      Get TextFieldBuilder for creating a TextField.
      Returns:
      TextFieldBuilder instance
    • makeResizable

      public static void makeResizable(Region region, Position... borders)
      Make a region resizable by dragging its edge.
      Parameters:
      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.
      Parameters:
      region - the region
      resizeMargin - size of the draggable margin
      borders - the borders to make draggable