Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Hyperlinks In Textareas

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Help the Canadian junior programmer type!
I'm trying to create a webpage (entirely Java based) that will use hyperlinks to open up a picture in a new web browser window. Essentially, the question is "How do I put a hyperlink into a TextArea?" - if it can be done?
I have seen similar posts elsewhere, but they got no responses. I figured Java Ranch would be the place to look....
Thanks muchly...
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want to use HTML objects (i.e., hyper links) you need to use JTextPane which handles HTML objects. TextArea will not handle it for you.
NOTE: That can't be your real name ... please read the JavaRanch naming policy here
[This message has been edited by Manfred Leonhardt (edited November 21, 2001).]
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Canadian Stands Corrected -
My apologies Manfred - I'll try to read the guide more carefully next time
However, I will try the JTextPanes. I did find an applet online (free sample one) that was a horizontal text scroller applet. The author did not use a single JTextPane in the program, but was able to put html hyperlinks into the program by using parameters in the html code... a search of the code (I am using TextPad4 as my java editor right now... am a starting programmer) didn't reveal any usage of JTextPane. However, as true as it is that I am dissecting the code to see how it was done, I wondered if there was an easier way. Thanks for the prompt response and I'll give it a shot.
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic