A single addEventHandler assigned to multiple objects
posted 1 year ago
I'm writing a simple application using FXML and Scene Builder. My goal is to add a text area to the scene after a button is pressed. The text area will simply be sticky note that I would like to be able to drag-and-drop into any of the 5 flow panes that are placed in an HBox. My program works fine now, but there are too many redundancies that I'd like to streamline.
What is the best way to condense the code?
Code below is in Controller class and adds text area
Following code placed within initialize method of controller: