CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Defining Fields

  1. #1
    Join Date
    Oct 2009
    Posts
    10

    Question Defining Fields

    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?

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Defining Fields

    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
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured