Click to See Complete Forum and Search --> : Defining Fields


Bear35805
October 19th, 2009, 02:34 PM
Ok I have seen this in other programs. What I want to do is present a record to the user that has multiple fields and let the user tell me where the field breaks are by clicking between where one field ends and the next begins. For a simple example FredSmith would be two fields, and the user can click between the "d" and "S" to tell me that First Name ends after the d and last name begins at the S. I want to do this in my program, anyone have any ideas what control to use, and can point me in the right direction on how to implement it?

dlorde
October 19th, 2009, 05:58 PM
You could use a JTextField, which gives you an editor with a caret the user can place with the mouse or keyboard. When it's in the correct place, you can call getCaretPosition() to find where it is in the text.

I'm not sure that a single mouse click alone is a good way to select and confirm the position, because it's easy to click in the wrong place, but it's your decision.

The important thing in science is not so much to obtain new facts as to discover new ways of think about them...
W. Bragg