Package semestralkaGUI

Source Code of semestralkaGUI.RunButtonListener

package semestralkaGUI;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import semestralka.AutomatConstructor;
import semestralka.Expression;

/**
*
* @author frantisek
*/
public class RunButtonListener implements ActionListener{
   
    MainFrame caller;

    public RunButtonListener(MainFrame caller) {
        this.caller = caller;
    }
   
    @Override
    public void actionPerformed(ActionEvent e) {
        AutomatConstructor a = new AutomatConstructor();
        Expression ex = new Expression(caller.input.getText(),true);
        if(ex.isValid()){
            caller.app.setAutomat(a.Construct(ex));
            caller.log.add(a.getLog());
            caller.log.repaint();
            caller.setCanvasImage(caller.app.generateGraphFile());
        }
        else
            JOptionPane.showMessageDialog(caller, "Invalid expression!");
    }
   
   
}
TOP

Related Classes of semestralkaGUI.RunButtonListener

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.