title: How to update a GUI while it's running
body: <p>So I have a JTextField displayed in a GUI. What I want to do is remove the text field when someone presses enter. I have already added ActionListener. I just want to know how to automatically update it without having to minimize it or something.</p>
  
  <pre><code>import java.awt.*;
  import java.awt.event.*;
  import javax.swing.*;
  
  public class Window extends JFrame{
  private JTextField TextField0;
  private JTextField TextField1;
  private JCheckBox CheckBox0;
  
  //CONSTRUCTOR
  public Window(){
      super("Checkbox");
      setLayout(new FlowLayout());
  
      TextField0 = new JTextField("Add field",15);
      add(TextField0);
      CheckBox0 = new JCheckBox("");
  
  
  
      HandlerClass handler = new HandlerClass();
      TextField0.addActionListener(handler);
  }
      //Method: HandlerClass
  public class HandlerClass implements ActionListener{
      public void actionPerformed(ActionEvent event){
          if(event.getSource()==TextField0){
              CheckBox0.setText(String.format("%s",event.getActionCommand()));
          }
      }
  }
  }
  </code></pre>
  
  <p><em>EDIT</em>: I figured it out guys! :D Thanks!</p>