Class CustomElement
java.lang.Object
real_time_traffic_simulation_with_java.gui.controlPanelElement.CustomElement
Utility class for creating commonly used UI controls with tooltips
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddTooltip(javafx.scene.control.Control control, String text) Add tooltip to a control, because we use it multiple timesstatic javafx.scene.control.ButtoncreateButton(String text, int width, String tooltipText, String backgroundColor) Create a button with specified propertiesstatic javafx.scene.control.TextFieldcreateTextField(String prompt, int width, String tooltipText) Create a text field with specified properties.
-
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 displaywidth- The width of the text fieldtooltipText- 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 textwidth- The width of the buttontooltipText- The tooltip textbackgroundColor- The background color (e.g., "#6A6733")- Returns:
- Configured Button
-
addTooltip
Add tooltip to a control, because we use it multiple times- Parameters:
control- The control to add tooltip totext- The tooltip text
-