• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to make jTextField 's input unscrollable?

 
Ranch Hand
Posts: 159
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All
i create a JTextField, i want to set it inputsize = 5(charaters)
i am doing like this
JTextField jTextField = new JTextField(5);
jTextField.setScrollOffset(0);
but it doesnot work out
it is still scrollable, i main i could input more than
5 charaters
How to fix JTextField's input size?
Thx in advance
Walter wang
 
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to create a class that extends PlainDocument and override the insertString() like this:


[This message has been edited by Paul Stevens (edited December 17, 2001).]
 
reply
    Bookmark Topic Watch Topic
  • New Topic