• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 161
  • Last Modified:

I want to make a change in a Java form and save it and make the change appear on another Java screen

I have a Java application where I am using Netbeans and I am changing a String field called name on the form and saving it to the database.  I want to make the change appear and update in another open screen without having to close and reopen the other screen.  How can I do this?

1 Solution
gdkinney_2Author Commented:
This is a Java application using Netbeans so the forms are TopComponents which I believe extend JPanel.
>> How can I do this?

a. add the second window as a listener to the form field of the first
b. try reading it from the db and update the second form
If both screens are controlled by one application, you can
add ActionListener to the textfield where the user inputs the string.
Then when the user pressees enter in this TextField
it will go to actionPerformed method where you can update another screen.
You can also save to database at that momemnt if necessary.

ActionListener will require pressing Enter
You can aslo use keyListener - it will report event when each key is pressed
but with that it is difficult to kniow when the user
finished input
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

You can use a DocumentListener to listen for changes to the textfield, and have the listener update the other form.

Or if its two text fields (one on each form) then you can simply have the two share the same Document model and they will both then stay in sync automatically
gdkinney_2Author Commented:
How would I use the Property Change Listener to do this?  Is that the way to go?
No a DocumentListener for text fields


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now