public void setFormEntry(ArrayList<String> fieldTitles, int numRecords) { // for(int x=0; x<fieldTitles.size(); x++){ formEntry.add(formEntry, fieldTitles, numRecords); // } for (int x = 0; x < numRecords; x++) { listModel.addElement((x + 1) + ""); } ListSelectionModel listSelectionModel = list.getSelectionModel(); listSelectionModel.addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (formEntry.getCurrentRecord() != list.getSelectedIndex()) formEntry.setCurrentRecord(list.getSelectedIndex()); } }); }
public void clearFormEntry() { formEntry.clear(); listModel.clear(); revalidate(); }