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 / General / September 2006

Tip: Looking for answers? Try searching our database.

A Simple jTextPane Problem

Thread view: 
mm - 25 Sep 2006 09:09 GMT
Hi all,

How do I code a jTextPane so that when a user clicks on (let say the
content of the jTextPane is "How are you?") the word "How" (only), that
word will appear in another jTextPane?

Any helps/samples would be greatly appreciated.

Thanks for your time.

MM
Deniz Dogan - 25 Sep 2006 09:42 GMT
> Hi all,
>
[quoted text clipped - 7 lines]
>
> MM

Hello.
May I ask if it's specifically a JTextPane that you want to use? Do you
know what the main difference between a JTextPane and a JTextArea is?

/Deniz Dogan
mm - 26 Sep 2006 01:39 GMT
Hi Deniz,

Thanks for replying.

I think the main defference between JTextPane and JTextArea is that
JTextArea's content type is plain only, while JTextPane can be plain or
in HTML format (Please correct me if I'm wrong, I'm new to Java). So I
think to put an action to the contents, JTextPane is more suitable than
JTextArea. But I have no idea how to do like in my first question.

Please help.

Thank You.
MM

> Hello.
> May I ask if it's specifically a JTextPane that you want to use? Do you
> know what the main difference between a JTextPane and a JTextArea is?
>
> /Deniz Dogan
Deniz Dogan - 26 Sep 2006 07:24 GMT
> Hi Deniz,
>
[quoted text clipped - 5 lines]
> think to put an action to the contents, JTextPane is more suitable than
> JTextArea. But I have no idea how to do like in my first question.

I have never worked with JEditorPane, nor its subclass JTextPane before,
but I reckon you could add a CaretListener to it and work with that.
Perhaps there's some better way to do it, that I don't know of.

Also check out this web page:
http://java.sun.com/docs/books/tutorial/uiswing/components/text.html

Hope I could help.

/Deniz Dogan


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



©2009 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.