I need help getting my action listener. I searched around and got a lot of help but I still can't quite get my issue resolved. It needs to perform an action when the user hits enter in a JTextField and I'm not even sure that I'm on the right track. I made notes where I am getting my errors and I believe that it is just a scope issue for the most part. It has been a while since I have wrote any code. Thanks in advance.
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class CurrencyConverter extends JFrame implements ActionListener{ double dollars; double pounds; public static void main(String[] args){ CurrencyConverter converter = new CurrencyConverter(); final JTextField dollarsField = new JTextField("", 25);//create JTextFields dollarsField.addActionListener(GetDollarInputListener());//error at this line final JTextField poundsField = new JTextField("", 25); poundsField.addActionListener(GetPoundsInputListener());//error at this line JFrame frame = new JFrame();//create JFrame frame.setTitle("Currency Converter");//set frame properties frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.add(converter.createGUI(dollarsField, poundsField));//call on createGUI to retrieve jpanel to create GUI and add it to the JFrame frame.pack(); frame.setSize(350,110); }//end main method JPanel createGUI(JTextField dol, JTextField pou){ JPanel text = new JPanel(new GridLayout(2,1)); JPanel labels = new JPanel(new GridLayout(2,1)); JPanel complete = new JPanel(new BorderLayout()); JLabel dollars = new JLabel("Dollars: "); JLabel pounds = new JLabel("Pounds: "); labels.add(dollars); text.add(dol); labels.add(pounds); text.add(pou); complete.add(labels, BorderLayout.WEST); complete.add(text, BorderLayout.CENTER); return complete; }//end createGUI method class GetDollarInputListener implements ActionListener{ public void actionPerformed(ActionEvent e){ } }//end GetDollarInputListener class class GetPoundsInputListener{ public void actionPerformed(ActionEvent e){ double poundsAmount = Double.parseDouble(converter.poundsField.getText());//error at this line } }//end GetPoundsInputListener class }//end CurrencyConverter class