Refresh JComboBox

Hi,

I cannot figure out why 'dataList.addItem("+++++++")' from class constructor works and 'dataList.addItem("--")' from reloadBasesList() method (which is being inveoked from the outter MainWindow class does not take any visual effect (there is no new element on the list) even though the number of elements is increasing. Could you help me?

publicclass ToolBar{

private JToolBar toolBar;

private JComboBox dataList;

// [...]

public ToolBar(final MainWindow app){

// [...]

dataList =new JComboBox(Parser.parseBases());

dataList.setModel(new DefaultComboBoxModel());

// [...]

toolBar.add(dataList);

dataList.addItem("+++++++");

}

publicvoid reloadBasesList(){

System.out.println("L: "+dataList.getItemCount());

dataList.addItem("--");

System.out.println("L: "+dataList.getItemCount());

}

}

Output:

L: 1

L: 2

[1635 byte] By [smatrica] at [2007-11-26 17:34:03]
# 1
[nobr]you could use 'repaint' method[code]dataList.repaint()[code][/nobr]
p_epia at 2007-7-9 0:02:03 > top of Java-index,Java Essentials,New To Java...