Performing data binding in Swing is pain in the ass. Some time ago I lost couple of hours to make it eventually working. Let’s take a closer look what you need to do to bind your data to view. Not any database just POJO with some field. Maybe there is a better way? I know Java FX offers some cool features on that area but I haven’t tested it yet. Ok, here we go:
- No external libraries – just plain Swing.
- Netbeans 7.4 IDE.
- Model class is extremally simple:
- Two Swing forms: MainView (with a TextField) & SubForm View (with a Label):
- The entry point
App.javawhere views and dummy data are created.
- The whole project strucutre:
What I want to achieve is to bind instance of the
Person class to the textField on the
MainView and to the label on the
SubForm. One common…
View original post 156 more words