See comments bolded in the code:
I finaly got my buttons to work and now I have added 3 more buttons which are not working and I added them the same way the other buttons that are working were added. the code compiles and runs with no errors but the 3 new buttons are not working the way I need them to. I think that its the action listener that is not workinng right.
here is what I have so far:import java.awt.*; import java.awt.event.*; import java.text.NumberFormat; // used to format currency import javax.swing.*; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; class InventoryMain extends Frame implements ActionListener { CD[] product; JTextField[] fields; NumberFormat nf; JButton jbtAdd, jbtFirst, jbtPrev, jbtNext, jbtLast, jbtDelete, jbtModify; JLabel label; // logo JPanel buttonJPanel; // panel to hold buttons String nameText; JComboBox combo; private int index; int i; // varialbe for looping double total = 0; // variable for total inventory static int dispProd = 0; // variable for actionEvents static JTextArea textArea; static int addProd = 0; static int deleteProd = 0; static int modifyProd = 0; public static void main(String[] args) { try { UIManager.setLookAndFeel( "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch (Exception e) { System.err.println(e.getClass().getName() + ": " + e.getMessage()); } InventoryMain test = new InventoryMain(); test.initCD(); test.showGUI(); test.populateFields(0); } public void initCD() { //Create an array product = new CD[10]; //fill in the classes product[0] = new CD( 1, "Crowbar" , 20.00, 10, "00722"); …