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

