Results 1 to 3 of 3

Thread: JTextField

  1. #1
    tnrh1 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    251
    Rep Power
    4

    Default JTextField

    Hello,
    I added an action listener to a button which do:
    Print the text from the Text Field and the clear it.
    Now after it happens I want that my pointer/aim(I forgot it's name) will be on the JTextField.
    How do I do that?

    And nother general question is, if I want to create a field that will print some text and he will be unchangable what should I use?
    For example a chat window, it prints messages but you can type in there.

    Thanks in advanced.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,932
    Rep Power
    8

    Default Re: JTextField

    Quote Originally Posted by tnrh1 View Post
    Hello,
    I added an action listener to a button which do:
    Print the text from the Text Field and the clear it.
    Now after it happens I want that my pointer/aim(I forgot it's name) will be on the JTextField.
    I think the word you're looking for us focus.

    Quote Originally Posted by tnrh1 View Post
    How do I do that?
    Check out the API. Hint: You're trying to request that your component receive the focus, right?

    Quote Originally Posted by tnrh1 View Post
    And nother general question is, if I want to create a field that will print some text and he will be unchangable what should I use?
    For example a chat window, it prints messages but you can type in there.

    Thanks in advanced.
    Any number of components could do the trick. JLabel? JTextArea? Again, check out the API for useful functions.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    tnrh1 is offline Senior Member
    Join Date
    Aug 2011
    Posts
    251
    Rep Power
    4

Similar Threads

  1. Replies: 3
    Last Post: 11-14-2011, 05:13 AM
  2. Replies: 0
    Last Post: 08-30-2011, 09:18 AM
  3. JTextField
    By gancio in forum AWT / Swing
    Replies: 20
    Last Post: 08-26-2009, 03:11 PM
  4. Replies: 1
    Last Post: 01-30-2009, 06:44 PM

Posting Permissions

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