Java Swing: separating UI components from logical behavior – how do you handle this?
What do I do in NetBeans, for example:
>Create a UI component class with the suffix swing component type, for example: JPanel, such as myuiwidgetjpanel > create a logic / behavior class to handle behavior / logic, that is, what happens when using UI components, for example, press the button, etc., myuiwidgetlogic
If the behavior / result of one component affects / affects another component, I can also use references to link components / logic together Some of the options displayed are no longer relevant or provide context sensitive options
What do you think of this? Okay? Bad?
What is your job?
Solution
I prefer to use presentation model pattern
In essence, it seems to be what you do: create a class containing logic, separate from the UI class UI classes should not contain logic - only the code required to display the interface
Then, you can bind the front-end value to the back-end presentation model class using content similar to jgoodies binding (I know spring RCP is also very suitable for this situation)