• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using Swing Components

 
Savio Mascarenhas
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guy's !!!
Which swing component is similar to the "JTextPane component" in the sense of it's "ability to display text in various different formats,styles & color" and
which also has the "ability to display continous text" and is "not dependent on the horizontal scrollbar" to view the text.(In this sense something like the "JTextField component" ).
Can the JTextPane component in some way be set to be "independent of the horizontal scrollbar" when the text in longer in length than the size of the component OR is there any other component that would serve the purpose .
Pls suggest.
Thanks Guy's.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, what do you mean by independent of the horizontal scroll bar. Meaning you do or do not want the Scroll Bar?? Meaning word wrapping??
Second, JTextPane and JEditorPane are the only two Swing components similar to the JTextArea that allow multi colored Text.

------------------
Happy Coding,
Gregg Bolinger
 
Savio Mascarenhas
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gregg !!!
That right Gregg ... "do not want the horizontal Scroll Bar " and also "text should not wrap" .
The Purpose is to use an input component that "supports mutlicolored text","does not have a horizontal Scroll Bar" and that "the text should not wrap" . Something like the input component used at chat.yahoo.com to "send the user's message" .
Which component satisfies this requirement ? Pls Suggest.
Thanks once again Gregg.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, you can use JTextPane. It will accept multicolored text. Then what you would do is myTextPane.setHorizontalScrollBarPolicy(JTextPane.Horizontal_Scroll_Never) and I am pretty sure that by default, it will not word wrap. You have to tell to do that, so you should be ok there. You might want to peek at the API though.

------------------
Happy Coding,
Gregg Bolinger
 
Savio Mascarenhas
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gregg !!!
You hit the nail on it's head .
Thanks Gregg.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!