PDA

View Full Version : Urgent :Problem with JTree


mayankgera
03-28-2009, 10:44 PM
Hi
I m using JTree and i m trying to create an editor-tree frame(like in netbeans)
when i click on any file in Jtree for that code should be opened in EditorPane

i have tried but in this i can not make work for JTree file selection


File openAs = new File("../Tool/src/tool/PropertyWindow.java");
FileReader in = new FileReader(openAs);
txtarea.setPage(in, openAs.toString());

shyam
03-29-2009, 11:00 AM
are you getting some specific error message?

mayankgera
03-29-2009, 02:00 PM
so error but when i load another file(frm JTree) into JEditorPane ,editorPane does not get reloaded to new file . it shows old file that i have set default on load.

I m getting the path frm JTree , here is the function of JEditorPane that i m using to addfile



public void addfile(String filePath)throws FileNotFoundException, IOException{
File openAs = new File(filePath);
FileReader in = new FileReader(openAs);
editor.read(in, filePath);
}