Hi all,
I'm designing a class to implement a form. I derive it from JPanel. The new class contains several JTextFields and other components that store data. I'll call this the 'inner panel'.
Then, I create a JFrame window that includes the inner panel and adds some buttons. I'll call this the 'outer panel'. The outer panel gets button events and asks the inner panel to do some things like "clear fields", "get data", etc. This works perfectly.
But I have a little problem. The outer panel (which can be several different things) must know if the inner panel state changes (for example, we add some text, change an option in the combobox, etc). And I don't know how to do this.
I've think to use events. That is, I implement in the outer panel an 'ChangeListener', that will receive inner panel produced events. But... how do I throw a ChangeEvent from inside the inner panel?
Any idea?
Thanks!
P
I've seen some fire* functions in other components, but I don't find any way to implement in my class a fireChangeEvent for example.
I'm designing a class to implement a form. I derive it from JPanel. The new class contains several JTextFields and other components that store data. I'll call this the 'inner panel'.
Then, I create a JFrame window that includes the inner panel and adds some buttons. I'll call this the 'outer panel'. The outer panel gets button events and asks the inner panel to do some things like "clear fields", "get data", etc. This works perfectly.
But I have a little problem. The outer panel (which can be several different things) must know if the inner panel state changes (for example, we add some text, change an option in the combobox, etc). And I don't know how to do this.
I've think to use events. That is, I implement in the outer panel an 'ChangeListener', that will receive inner panel produced events. But... how do I throw a ChangeEvent from inside the inner panel?
Any idea?
Thanks!
P
I've seen some fire* functions in other components, but I don't find any way to implement in my class a fireChangeEvent for example.