Class CustomElement

java.lang.Object
real_time_traffic_simulation_with_java.gui.controlPanelElement.CustomElement

public class CustomElement extends Object
Utility class for creating commonly used UI controls with tooltips
  • Constructor Details

    • CustomElement

      public CustomElement()
  • Method Details

    • createTextField

      public static javafx.scene.control.TextField createTextField(String prompt, int width, String tooltipText)
      Create a text field with specified properties. So instead of repeating code, we can just call this method.
      Parameters:
      prompt - The prompt text to display
      width - The width of the text field
      tooltipText - The tooltip text
      Returns:
      Configured TextField
    • createButton

      public static javafx.scene.control.Button createButton(String text, int width, String tooltipText, String backgroundColor)
      Create a button with specified properties
      Parameters:
      text - The button text
      width - The width of the button
      tooltipText - The tooltip text
      backgroundColor - The background color (e.g., "#6A6733")
      Returns:
      Configured Button
    • addTooltip

      public static void addTooltip(javafx.scene.control.Control control, String text)
      Add tooltip to a control, because we use it multiple times
      Parameters:
      control - The control to add tooltip to
      text - The tooltip text