Friday 15 April 2011

java - Communication between JPannel components -



java - Communication between JPannel components -

i'am creating simple application gui , i'am having pannels individual classes included in mainframe. asking here right approach, how should panels in separated classes communicate in example: have button in panel1 , textarea in panel2, want click on button append string in textarea individual components(classes). button1 doesnt have textarea in scope. know can set getter button , add together listener in class need want here right approach help appreciated!

swing revolves around mvc pattern. in case views components , controller might combination of listeners , actual controller class knows views. model depends on application , specific needs.

if button needs update single textarea listener sufficient. pass reference textarea should updated listener.

here's oracle tutorial on mvc: http://www.oracle.com/technetwork/articles/javase/index-142890.html

java user-interface communication jcomponent

No comments:

Post a Comment