This is a discussion on Help Needed Understanding Composite Beans & Event Handling - Java ; Okay, so I'm confused . again . J. I'm trying to understand the relationships between components and how they communicate changes, entered on a composite GUI, to the underlying model that is subsequently used to update a file and/or database ...
Okay, so I'm confused . again . J.
I'm trying to understand the relationships between components and how they
communicate changes, entered on a composite GUI, to the underlying model
that is subsequently used to update a file and/or database table.
Composite beans appear to be the best way to build complex GUI's. However,
I've read and re-read a ton of material on event processing and how it
should be handled and, to be honest, it has gotten to be all smooshed-up in
my gray-matter to the point where I'm confused as all hell.
As an example, I've built an application in the following manner:
There are 5 GUI beans (JPanels) each containing a number of JTextFields and
corresponding String properties each with their own getters & setters.
These 5 GUI beans are added to a main GUI bean (JPanel).
This main GUI bean (JPanel) is then added to a JFrame (main application
driver) which presents this composite GUI to the user.
There is also a model class that contains the (String) properties that the 5
GUI beans mentioned above will (event .. ually ) set.
How do the 5 GUI beans communicate their JTextField changes to the model?
Does each bean have a reference to the model class? Or, is there only one
model reference? If so, where it this model object, the JFrame, an external
event handler?
What about listener registration? Is each JTextField only associated with
an ActionEvent and access to the actionPerformed() method and/or is each
JTextField also registered with an event handler (anonymous, inner or
external)?
In any case, just how is the model to be updated with the modifications
made to the JTextFields as each of these 5 GUI beans is imbedded within
another bean imbedded within a JFrame?
I guess my real confusion is the event processing flow and which component
communicates with which?
If someone could provide a simple but detailed process walk-thru using a
composite bean example (like the one described above) , this would help
allot.
--
Steve Campisano
Northrup Grumman IT
Deployment Engineer