• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

listen for changes in other jPanels

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone!
I would like to ask a question related to passing values between jPanels.
For example, I have a jFrame and 5 jPanels, I am switching jPanels by CardLayout. jPanels have a lot of jTextFields and jComboBoxes.
Every jPanel have saveButton, by clicking saveButton I am getting values from jTextFields and jComboBoxes and writing them into text file.
The layout of text file:

And I get stuck on this part:
if jTextfield3 of jPanel 3 is not empty and have some value, then it must be printed in under jPanel2 values too:

And if jTextfield3 of jPanel 3 is empty, then it must not printed in jPanel2:

I would like to ask how to listen for changes in other jPanels, how to create communication between jPanels which managed by CardLayout?

Any help is greatly appreciated.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would recommend an event bus. Allows you to have totally loose and dynamic coupling.
Check out https://github.com/olostan/simpleventbus
and http://dev-crossroads.blogspot.in/2011/04/very-simple-eventbuspubsub.html
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic