• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

opening a file from click event

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm basically building this editor using java. basically i want to click on the name of a file in a JTextArea and open it in an editor. How might I go about doing this. Would I have to add a listener to the entire textArea and then return back the string which was clicked on.Or is there an easier way of doing this.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This would be quite a complex task. It would involve adding a mouselistener to the textarea, and finding out the word under the mouseEvent point. That would require a bit of work!
Dave
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ciaran,
Is the JTextArea in which to click on a file name same as the JTextArea used as editor ?? i.e. is the file name hyperlink is in editor itself or it is in separate text area??
 
ciaran Hurst
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ashish Mahajan:
Hi Ciaran,
Is the JTextArea in which to click on a file name same as the JTextArea used as editor ?? i.e. is the file name hyperlink is in editor itself or it is in separate text area??


its just a seperate text area. In fact i will more then likely have to pull the name off the textarea and and search throung the directory structure for the name
 
Ashish Mahajan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ciaran,
On more ques. :-
can we use JTextPane instead of JTextArea as text component used to show the file name (and not the editor)???
If that is the case then the ans is very simple. Let's know.
 
Tomorrow is the first day of the new metric calendar. Comfort me tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic