[ Back | Previous | Next ]

How to create a object treemodel and treenodes?

Package:
javax.swing.tree.*
Product:
Swing
Release:
1.0.3
Related Links:
DefaultTreeModel
JTree
Comment:
		DefaultMutableTreeNode root = new DefaultMutableTreeNode(new SampleData(Organisatie.class, "OVERZICHT"));
		ivjTreeModel = new DefaultTreeModel(root);
		Vector melders = getTopLinkSession().readAllObjects(Melder.class);
		if (melders != null)
			System.out.println("Loaded " + melders.size() + " melders.");
		//--------------------
		for (int i = 0; melders != null && i < melders.size(); i++) {
			Melder mldr = (Melder) melders.elementAt(i);
			Vector waterklerk = (Vector) mldr.getWaterklerken();
			Vector agenten = (Vector) mldr.getAgents();
			Vector schepen = (Vector) mldr.getSchepen();
			//

			String treeString = (String) mldr.toString();
			SampleData sdr = new SampleData(mldr, treeString);
			DefaultMutableTreeNode dmt = new DefaultMutableTreeNode(sdr);
			root.add(dmt);
etc….
1