title: How to increment/intake multiple events with different inputs using ActionListener
body: <p>I am trying to get an input of a details of multiple events and print them in the TextArea. However, each event I put in resets every time I put in a new input, but I want to keep my initial event and then add onto it, if that makes sense. How can I fix my code to do that? Do I need a loop?</p>
  <pre><code>import java.awt.event.ActionListener;
  import java.awt.event.ActionEvent;
  import javax.swing.*; 
  
  public class Interface {
  
      public static void main(String[] args) {
  
          WidgetViewer wv = new WidgetViewer();
          
          JLabel eventName = new JLabel(&quot;Event Name&quot;);
          wv.add(eventName, 10, 30, 300, 20);
          
          JTextField name = new JTextField();
          wv.add(name, 10, 50, 300, 20);
          
          JLabel eventVenue = new JLabel(&quot;Event Venue&quot;);
          wv.add(eventVenue, 10, 70, 300, 20);
          
          JTextField venue = new JTextField();
          wv.add(venue, 10, 90, 300, 20);
          \\ And similar code for the rest of the inputs
          
          JButton create = new JButton(&quot;Create an Event&quot;);
          wv.add(create, 10, 320, 300, 20);
          
          JTextArea text = new JTextArea(&quot;&quot;);
          wv.add(text, 10, 460, 900, 20);
          
          create.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e){
                  
                  String eventName = name.getText();
                  String eventVenue = venue.getText();
                  int venueCapacity = Integer.parseInt(capacity.getText());
                  String eventDate = date.getText();
                  int ticketsSold = Integer.parseInt(sold.getText());
                  int ticketPrice = Integer.parseInt(price.getText());
                  int overhead = Integer.parseInt(costs.getText());
                  Event event1 = new Event(eventName, eventVenue, venueCapacity, eventDate, ticketsSold, ticketPrice, overhead);
                  
                  text.setText(&quot;Event &quot; + event1.getEventName() + &quot;, Venue: &quot; + event1.getEventVenue() + &quot;, Date: &quot; + 
                  event1.getDate() + &quot;, Tickets Sold: &quot; + event1.getTicketsSold() + &quot;, Ticket Price: &quot; + 
                  event1.getTicketPrice() + &quot;, Overhead: &quot; + event1.getOverhead() + &quot;, Venue Capacity: &quot; + event1.getVenueCapacity() + &quot;, Profit: &quot; + event1.getProfit() +
                          &quot;, Break Even Point = &quot; + event1.getBreakEvenPoint());
                  
                  name.setText(&quot;&quot;);
                  venue.setText(&quot;&quot;);
                  capacity.setText(&quot;&quot;);
                  date.setText(&quot;&quot;);
                  sold.setText(&quot;&quot;);
                  price.setText(&quot;&quot;);
                  costs.setText(&quot;&quot;);
                  
              }
          });   
  
      }
  
  }
  </code></pre>