Ok I put this code in the jbutton section and I kept receiving an error that said "Illegal start of expression" I don't know enough to see anything wrong with this. Netbeans didn't say anything else.
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
//invoke this when add button fired
private static final void addList(){
dlm.addElement((Object)jTextField1); // add name
dlm.addElement((Object)jTextField2); // add lastname
}
}
and this code I put at the very top of the code, their is more like the rest of the GUI, but I didn't paste it because its too long.
package editor;
import javax.swing.JList;
import javax.swing.*;
/**
*
* @author Philip
*/
class MyMainClass{
DefaultListModel dlm = new DefaultListModel();
JList jlist = new JList( dlm );
}
public class NewJFrame extends javax.swing.JFrame {
/** Creates new form NewJFrame */
public NewJFrame() {
initComponents();
}