ReadOnly JTextField

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kid Programmer
    New Member
    • Mar 2008
    • 176

    ReadOnly JTextField

    Hello guys. I was wondering if it is possible to make a JTextField read only. In a program I am writing I don't want the user to be able to edit the text in a JTextField.
  • Laharl
    Recognized Expert Contributor
    • Sep 2007
    • 849

    #2
    Look at the API for JTextComponent and JTextField. There's something like setEditable.

    Comment

    • Kid Programmer
      New Member
      • Mar 2008
      • 176

      #3
      Originally posted by Laharl
      Look at the API for JTextComponent and JTextField. There's something like setEditable.
      Thanks that worked :-)

      Comment

      • JosAH
        Recognized Expert MVP
        • Mar 2007
        • 11453

        #4
        Another lesson learned: always read the appropriate API documentation sections
        first before you start banging that keyboard; it saves you a lot of time.

        kind regards,

        Jos

        Comment

        Working...