Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / August 2005

Tip: Looking for answers? Try searching our database.

JTextPane woes...

Thread view: 
Frances - 28 Aug 2005 14:15 GMT
  I need to switch from JTextArea to JTextPane b/c need to change font
color according to user input, but am running into all sorts of
problems..  you can't specify a size in rows and columns like you can in
JTextArea, setSize() is being ignored..  also why no append() method in
JTextPane.. how do I achieve what append() method does...  such
complication simply b/c I need to change font color (JUST font color)
according to user input... :(

(this is for an IM chat window...  so on top window need to display
users' ID with their message..  ID needs to be a diff. font color..
sounds simple.. but well, JTextPane making this very complicated..)

would very much appreciate some help..  thank you..
Christian Kaufhold - 28 Aug 2005 15:35 GMT

>   I need to switch from JTextArea to JTextPane b/c need to change font
> color according to user input, but am running into all sorts of
[quoted text clipped - 9 lines]
>
> would very much appreciate some help..  thank you..

Please calm down.

JTextArea.append() is just a shorthand for getDocument().insertString(getDocument.getLength(), %, null);

size in rows and columns does not make sense for JTextPane in the generic
case (because there is not one fixed font), but they can be done similar to
as JTextArea if desired (override getPreferredScrollableViewportSize and
maybe getPreferredSize, see JTextArea source; it is really not difficult).

Christian
Frances - 28 Aug 2005 18:11 GMT
>  
>
[quoted text clipped - 22 lines]
>
> Christian

thank you very much Christian, I will try all this...


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.