• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 165
  • 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?

Thanks
0
gdkinney_2
Asked:
gdkinney_2
1 Solution
 
gdkinney_2Author Commented:
This is a Java application using Netbeans so the forms are TopComponents which I believe extend JPanel.
0
 
CEHJCommented:
>> 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
0
 
for_yanCommented:
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
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
objectsCommented:
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
0
 
gdkinney_2Author Commented:
How would I use the Property Change Listener to do this?  Is that the way to go?
0
 
objectsCommented:
No a DocumentListener for text fields

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

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