I am new to javafx. Created an application with three elements: a text box for entering a number, a "confirm" button and a label for displaying the result.
The listener is tied to the "confirm" button, in which the result is calculated by the formula.
The question is: how can I use this GUI alone for many applications with other formulas in the listener's body? Of course, you can simply copy and paste the code by rewriting the formula in the listener's body, but I'm looking for an object-oriented method.
HashMap. The key will be the name of the formula, and the value of some class with the processor of the formula. All handlers will have a base type, for exampleFormulaand from it createPriceFormulaclasses, etc. On gui create a combobox with a choice of some kind of formula. If in the future we plan to add fields, then it will be more difficult. I suggest that you make your own components, which themselves know their formula and their fields. - Tsyklop pm