Sorry to be a pain, I've gone off on a tangent to the original idea, currently trying to get it removing elements from the list
Code:
private void btnremoveActionPerformed(java.awt.event.ActionEvent evt) {
int index = listemail.getSelectedIndex();
listemail.remove(index);
int size = listModel.getSize();
if (size == 0) { //No email records left, disable the button
btnremove.setEnabled(false);
} else { //Select an index.
if (index == listModel.getSize()) {
//removed item in last position
index--;
}
listemail.setSelectedIndex(index);
listemail.ensureIndexIsVisible(index);
}
}
Its throwing an error on listmodel, and again on adding items to the list
Code:
private void btnremoveActionPerformed(java.awt.event.ActionEvent evt) {
int index = listemail.getSelectedIndex();
listemail.remove(index);
int size = listModel.getSize();
if (size == 0) { //No email records left, disable the button
btnremove.setEnabled(false);
} else { //Select an index.
if (index == listModel.getSize()) {
//removed item in last position
index--;
}
listemail.setSelectedIndex(index);
listemail.ensureIndexIsVisible(index);
}
}
I grabbed the base code from http://download.oracle.com/javase/tu...t.html#mutable and modified it to fit the form I've got, but I can't figure out what I should be changing listModel to.
Man, why does java have to be so complicated. 
Edit: Having moved on, I now can't run my darn program to test the other code I've written (thanks to your first post for the platform though
)
It may work, but it can't find the main class, I think I scouted the problem, but it wants me to declare my public class in its own .java file (using netbeans 6.9)
I only added in that public class, because without it it my "class" does not have a main method.
I'm digging myself deeper into a hole.
Bookmarks