word wrap, JTextPane, and JTextField
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Glenn_Josefiak
Posted On:   Thursday, August 1, 2002 08:27 PM

I would like to make a styled-text version of a JTextField , a " OneLineTextPane ." I attempted to do this by overriding a JTextPane and doctoring it: set OneLineTextPane 's Document to a new overridden DefaultStyledDocument . override the insertString method of the DefaultStyledDocument using String regular expressions to eliminate carriage returns. This still does not give me what I want. If I type past the visible area of the OneLineTextPane , word wrap (a.k.a line wrap) kicks in. How can I eliminate word wrap? I would like the OneLineTextPane to    More>>

I would like to make a styled-text version of a JTextField , a " OneLineTextPane ."
I attempted to do this by overriding a JTextPane and doctoring it:


  • set OneLineTextPane 's Document to a new overridden DefaultStyledDocument .
  • override the insertString method of the DefaultStyledDocument using String regular expressions to eliminate carriage returns.


This still does not give me what I want. If I type past the visible area of the OneLineTextPane , word wrap (a.k.a line wrap) kicks in. How can I eliminate word wrap?


I would like the OneLineTextPane to behave like a JTextField in that as I add more characters to the (right) end of the string, the view of the document scrolls off to the left. This does not seem to be easily available with the JTextPane . Doesn't seem to be something I can accomplish with a JScrollPane either....


Any suggestions?

Thanks.

Glenn

   <<Less
About | Sitemap | Contact