Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

opening a file from click event  RSS feed

 
ciaran Hurst
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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.
 
Dave Smith
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • 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
 
Ashish Mahajan
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!