title: Why is there an issue with an actionListener's action being defined within another definition of an actionListener?
body: <p>I'm getting two errors in relation to end brackets.
  Clearly the issue is how the action listeners are defined; check the answers for a succinct and easy fix. I can't delete this (terrible) post, so I'm trying to edit it post mortem in hopes I can avoid my misactions from seven years ago preventing my posting abilities today. Don't ask questions like this, and moreso, if you run into this issue, use the answers linked to this question instead of asking your own.</p>
  
  <pre><code>package firstframe;
  import javax.swing.*;
  
  import java.awt.*;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import java.awt.Font;
  import java.util.Properties;
  import java.text.*;
  import java.util.ArrayList;
  public class frame {
  
      genericclass twelveoclockfix;
      JFrame Frame1;
      JPanel j2;
      JPanel j4;
      JButton b1;
      JButton b2;
      JTextField t1;
      ArrayList&lt;Integer&gt; hour;
      ArrayList&lt;String&gt; minute;
      JComboBox&lt;Integer&gt; t2;
      JComboBox&lt;String&gt; t3;
      JComboBox&lt;String&gt; t4;
      JPanel j1;
      JLabel l1;
  
      public frame() {
          //twelveoclockfix = new genericclass();
          Frame1 = new JFrame("9gag's own: jClock");
          j2 = new JPanel();
          j4 = new JPanel();
          b1 = new JButton ("Get le Time!");
          b2 = new JButton ("Set le Alarm!");
          t1 = new JTextField(10);
          hour = new ArrayList&lt;Integer&gt;();
          for (int i = 1; i &lt;= 12; ++i) {
              hour.add(i); String.format("%05d", 2);
          }
          minute = new ArrayList&lt;String&gt;();
          for (int i = 01; i &lt;= 59; ++i)
          {
              if (i &lt; 10) {
                  minute.add("0" + String.valueOf(i));
              } else {
                  minute.add(String.valueOf(i));
              }
          }
          t2 = new JComboBox&lt;&gt;(hour.toArray(new Integer[0]));
          t3 = new JComboBox&lt;&gt;(minute.toArray(new String[0]));
          t4 = new JComboBox&lt;&gt;(new String[]{"AM", "PM"});
          j1 = new JPanel (new FlowLayout());
          l1 = new JLabel ("time in comic sans:");
          j1.add(l1);
          j1.add(t1);
          j2.add(b1);
          j4.add(b2);
          j4.add(t2);
          j4.add(t3);
          j4.add(t4);
          l1.setFont(new Font("Comic Sans MS",Font.PLAIN,20));
          t1.setFont(new Font("Comic Sans MS",Font.PLAIN,20));
          b1.setFont(new Font("Comic Sans MS",Font.PLAIN,20));
          Frame1.add(j1);
          Frame1.add(j2);
          Frame1.add(j4);
          Frame1.setLayout(new FlowLayout());
          Frame1.setSize(400,150);
          Frame1.setVisible(true);
          Frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          b2.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
          b1.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                  t1.setText(""+genericclass.twelveoclockfix + ":" + genericclass.minfixed + " " + genericclass.AMPMtxt);
                  System.out.println(t2.getSelectedItem());
                  JOptionPane.showMessageDialog(Frame1, "Le 9gag army waz h3r3!");
  
              }});
  
  
      }
  }
  </code></pre>