hey, I am fairly new to Java and I have to write a program that uses the mvc design pattern. It calculates the maximum data rate when the user changes the signal to noise and bandwidth. I need to create an action listener for when the user changes the values but I am not sure how to do that.
private JPanel createBandwidthPanel(){ JPanel bandwidthPanel = new JPanel(); bandwidthPanel.setLayout(new BoxLayout(bandwidthPanel, BoxLayout.LINE_AXIS)); JLabel bandwidthLBL = new JLabel("Bandwidth(in hertz):"); JTextField bandwidthTXTFLD = new JTextField(); bandwidthTXTFLD.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { Double.parseDouble(bandwidthTXTFLD.getText()); } }); bandwidthPanel.add(bandwidthLBL); bandwidthPanel.add(bandwidthTXTFLD); return bandwidthPanel; }