Results 1 to 5 of 5
  1. #1
    bsebal28 is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

    Default How to create a JTextField that the user CAN NOT type in?

    For a project that I am doing in class, i have a JTextField that I do not want the user to be able to type in. It will be used to display numbers after certain calculations are made. Does anybody know how to do this?

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Look at the JTextField API (you need to make a habit of looking at the API for this sort of stuff, so may as well start now). any methods look promising?

  3. #3
    bsebal28 is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

    Default

    I did look in the API and what I found wasn't working so that's I made an account to here.....my guess is removeActionListener(ActionListener l) but i cant get that to work. if that is the right method, what would the ActionListener be?

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    nah. A textfield can be edited when it is editable. Look for a method called setEditable.

  5. #5
    bsebal28 is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

Similar Threads

  1. Replies: 1
    Last Post: 01-30-2009, 07:44 PM
  2. Replies: 0
    Last Post: 01-14-2009, 02:26 PM
  3. Replies: 2
    Last Post: 12-23-2008, 07:35 PM
  4. How to create jTextField autocompletion
    By radix in forum New To Java
    Replies: 6
    Last Post: 11-08-2008, 04:55 PM
  5. [SOLVED] Cast string type to int type
    By GilaMonster in forum New To Java
    Replies: 9
    Last Post: 09-17-2008, 11:43 AM

Posting Permissions

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