WonderMouse
WonderMouse

Reputation: 45

JTextField scrollable with no JScrollBar

Is it possible to have JTextField scrollable without use of JScrollBar. For example, I would define field as max size 120, but only 40 to be visible, the rest is scrollable (left/right). Similar, that HTML INPUT TEXT works.

Upvotes: 0

Views: 162

Answers (1)

camickr
camickr

Reputation: 324207

If you want to limit the user to entering 120 characters into the text field then you would use a DocumentFilter. Read the section from the Swing tutorial on Implementing a DocumentFilter for a working example.

Upvotes: 1

Related Questions