File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes JTable JTextField value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable JTextField value" Watch "JTable JTextField value" New topic

JTable JTextField value

Shannon Sims
Ranch Hand

Joined: Jul 03, 2003
Posts: 197
Is there a simple way to get the original value from the JTextField before the user updated it? If the cell contains a value of 10 and then the user updates the value to 35, how can I get back the 10? I'm guessing I have to store the original value before the user edits the cell?

Thanks for everyone's feedback.
Naga Malleshwararao

Joined: Oct 22, 2006
Posts: 4
First you should be clear where 10 is actually stored. If 10 is in database you can fetch the value from the database and you can compare it with the updated value in textfield. If you 10 is generated at run time you have to store the 10 in a variable before updating.
Shannon Sims
Ranch Hand

Joined: Jul 03, 2003
Posts: 197
Thanks Naga for your reply. The value is stored in the database, however I was hoping that perhaps JTextField or it's super had some functionality that stores the previous value. I've decided to store the value before the user edits it.

Thanks again.
I agree. Here's the link:
subject: JTable JTextField value
It's not a secret anymore!