Hello

The table's cells contain integer values. I would like to save each one of theme them in an array of integers.
The problem is, I don't know how to do so. I tried to use the getValueAt method, but I always get error messages.
I tried something like:

Object o = table.getModel().getValueAt(i, j);
a[x]=Integer.parseInt(o.toString());

When I made a test to make sure that the data are well stored.

JOptionPane.showMessageDialog(null, a[0]);
System.exit(0);

The IDE hangs.

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

Please help.
Thank you.

Recommended Answers

All 3 Replies

Posting this in the Java forum would probably get you an answer sooner.

Moved

you might want to post a bit more code than that if you want an answer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.