how can i fill the JTree form database? please help

Dear all

my database is MS Access

I have two tables

-Countries table contain country_id and country_desc

- cities table contain city_id,city_desc,country_id

i need to make a tree with countries and cities

my class as follow:

--

public class SystemFrame extends JFrame {

private JPanel panelCenter = new JPanel();

private JLabel statusBar = new JLabel();

private JTree systemTree = new JTree();

// constructor

public SystemFrame() {

try {

jbInit();

} catch (Exception e) {

e.printStackTrace();

}

}

private void jbInit() throws Exception {

this.getContentPane().setLayout( layoutMain );

panelCenter.setLayout( null );

this.setSize( new Dimension(400, 300) );

this.setTitle( "Country Menu" );

statusBar.setText( "staus bar" );

systemTree.setAutoscrolls(true);

systemTree.setBorder(BorderFactory.createTitledBorder("CountryMenue"));

systemTree.setForeground(Color.red);

systemTree.setToolTipText("Select desired city");

this.getContentPane().add( statusBar, BorderLayout.SOUTH );

this.getContentPane().add( panelCenter, BorderLayout.NORTH);

this.getContentPane().add(systemTree, BorderLayout.CENTER);

this.setVisible(true);

}

public static void main(String args[]) {

SystemFrame frm = new SystemFrame();

}

}

i need to fill my JTree with data in tables. I do not know how

Please help

[1532 byte] By [tarek_fathia] at [2007-10-3 2:39:18]
# 1
You need to implement a tree model to describe your data structure.Start from reading the java doc about javax.swing.tree.TreeModel
LRMKa at 2007-7-14 19:37:33 > top of Java-index,Java Essentials,New To Java...