I have Jlist that have list of tables . I want the user to select table from the JList and this should change the values in the JTable that being created next to JTable. However, I get exception "Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException"
I know this exception result of the object not being created.
If I let the program read the first Table from JList it will work fine as soon as I select different value from JList and give me Exception in thread "AWT-EventQueue-0" java.lang.IndexOutOfBoundsException.
My listener is simply
table.setModel(New TableModel):
It was problem with directory because JTable read from files . here is my code for the listener if any body interested. CSVReader is AbstractTableModel that read CSV file I don't expect answer.
class SharedListSelectionHandler implements ListSelectionListener {
public void valueChanged(ListSelectionEvent e) {
ListSelectionModel lsm = (ListSelectionModel)e.getSource();
if (!lsm.isSelectionEmpty()) {
CSVReader newCSV = new CSVReader((String)FileList.getSelectedValue());
table.setModel(newCSV);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.