i have created a Jcombobox and i have populated it from data base, i have a JList and i want every item i select in the combobox to be added on the JList. i'm new to java and i tried to solve the problem with this code but it's not working :
private void addelementActionPerformed(java.awt.event.ActionEvent evt) {
DefaultListModel liss = new DefaultListModel();
Object s = empcombo_s.getSelectedItem().toString();
for(int i =0; i<=1;i++) {
liss.add(i, s);
}
stagelist.setModel(liss);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…