// TransPanel.java

import javax.swing.*;
import java.awt.event.*;

/** A Panel to obtain the character on a transition being added to the nfa.
 
 *  @author <a href="mailto:bergmann@rowan.edu"> Seth Bergmann </a>
 *  @author <a href="mailto:gspyo@jersey.net"> Greg Safko </a>
 */

public class TransPanel extends JPanel implements ActionListener
{

JButton okButton;
JTextField txtField;
NFA nfa;

public TransPanel (NFA n)
{  okButton = new JButton ("OK");
   add (okButton);
   txtField = new JTextField ("Enter a character");
   add (txtField);
   okButton.addActionListener (this);
   nfa = n;
   setVisible (true);
}


/** OK button has been clicked.  Get the char and hide this panel.
 */
public void actionPerformed (ActionEvent evt)
{  nfa.transChar = txtField.getText().charAt(0);
   setVisible (false);
}


}

