• Post Reply Bookmark Topic Watch Topic
  • New Topic

Detecting edited data and creating dynamic text field border  RSS feed

 
Chris Reed
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a Swing form where I want to detect edited field data so I can update the data via a web service. There doesn't seem to be a simple way to do this as there are a plethora of medium to complex code examples for this, most of which are over my head! LOL. However, I think I found a simple solution that will fit my needs and I wanted to run it by the group for input / suggestions. FYI: it may not matter but know that I am using NetBeans so things like listeners are auto-coded by the app.

Step 1: When I load the form, I am saving all the data to a Class array so I know the starting point of the each field. Here is the code for that load:


Step 2: I created a Lost Focus event listener for one field and am testing the current value of the field against the array:


Besides the general question of "is this an OK approach?", I would like to be able to pass the field name to the createEditBorder method so each listener can call it and I have one method for "edited text" formatting.

Thanks.



Update:
Trying to make the border method more flexible I've tried a signature like this:


But NetBeans throws an error for: "cannot find symbol JTextField"...
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!