Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JtextPane of one Line

I want to implement a JTextField with custom fonts.I came to know that we cannot do that in JTextField. Now I am using JtextPane i have a problem How to make sure the carat doesn't go to the next line when the user press enter. ?

like image 780
Arjit Avatar asked Dec 11 '25 17:12

Arjit


1 Answers

Add a DocumentFilter and prevent inserting "\n" chars there.

like image 84
StanislavL Avatar answered Dec 14 '25 06:12

StanislavL



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!