what is the best path for
To: comp.lang.java.gui
Hi all,
this my first post in this group, I need display data about import but
not know the best path for make this.
examplo, is "my application":
[code]
package simple;
public class FileData {
private String name;
private int size;
public FileData(String name, int size) {
setName(name);
setSize(size);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
}
[/code]
[code]
package simple;
import java.util.ArrayList;
import java.util.List;
public class ImportData {
private String origem;
private List files = new ArrayList();
public ImportData(String origem) {
this.origem = origem;
}
public void add(FileData fi) {
files.add(fi);
}
public int countFiles() {
return files.size();
}
}
[/code]
[code]
package simple;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
public class Simple {
public static void main(String[] args) {
Hashtable<String, List> hash = loadData();
//continue make JTree
}
/**
* This data will be loaded dynamic.
* @return
*/
private static Hashtable<String, List> loadData() {
Hashtable<String, List> hash = new Hashtable<String, List>();
List<ImportData> listOrigem1 = new ArrayList<ImportData>();
List<ImportData> listOrigem2 = new ArrayList<ImportData>();
ImportData data1 = new ImportData("1");
FileData fd1 = new FileData("clients.txt",10);
FileData fd2 = new FileData("products.txt",5);
data1.add(fd1);
data1.add(fd2);
ImportData data2 = new ImportData("2");
FileData fd3 = new FileData("clients.txt",10);
FileData fd4 = new FileData("products.txt",5);
data2.add(fd3);
data2.add(fd4);
listOrigem1.add(data1);
listOrigem2.add(data2);
hash.put("54", listOrigem1);
hash.put("60", listOrigem2);
return hash;
}
}
[/code]
I need shows:
[IMPORT]
[54]
[1]
[clients.txt]
[products.txt]
[60]
[2]
[clients.txt]
[products.txt]
and i too handle the event in JTree when user select a node and show
more info in JTable.
please what is the best path of loaded this data for my JTree ?
it is good I make my TreeModel implementations ?
thanks a lot !
sorry my english I not speak native.
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24