Dynamic Field in Swing

hi friends

I have a JCombobox having 3 items and a JList. Now suppose some one selects the first item from the combobox say Item1 then according to that item the contents of list should be displayed and if he selects Item2 then according to that item the contents of list would be changed dynamically.

so anyone plz help me to solve my this problame i also paste the code which i thought to solve the above problame but i can't work.

String[] mah = {"listItem1","listItem2"};

Object[] mahObj = (Object[])mah;

private void sStateItemStateChanged(java.awt.event.ItemEvent evt) {

// TODO add your handling code here:

if(evt.getStateChange() == ItemEvent.SELECTED)

state = (String)evt.getItem();

if(state.equalsIgnoreCase("Item1")){

mCombo.setListData(mahObj);

}

}

ishan

[852 byte] By [ishana] at [2007-11-27 2:29:18]
# 1
Please post Swing questions in the Swing forum: http://forum.java.sun.com/forum.jspa?forumID=57
DrLaszloJamfa at 2007-7-12 2:42:21 > top of Java-index,Java Essentials,New To Java...