I binding an array to JComboBox
like the following:
String[] arr={"ab","cd","ef"};
final JComboBox lstA = new JComboBox(arr);
but I want bind array to JComboBox
dynamically like the following:
final JComboBox lstA = new JComboBox();
void bind()
{
String[] arr={"ab","cd","ef"};
// bind arr to lstA
}
How to do it?
A little odd workaround(mine :)), might useful to you
final JComboBox lstA = new JComboBox();
String[] arr={"ab","cd","ef"};
lstA.setModel(new JComboBox(arr).getModel());