实训要求:
代码:
EquationException类:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class EquationException extends RuntimeException {
public static final int NONE_EQUATION = 1;
public static final int NO_REALROOT = 2;
private int errorCode;
public EquationException(String msg, int errorCode) {
super(msg);
this.errorCode = errorCode;
}
public int getErrorCode() {
return errorCode;
}
}
public class EquationFrame extends JFrame implements ActionListener {
SquareEquation equation;
JTextField textA, textB, textC;
JTextArea showRoots;
JButton controlButton;
public EquationFrame() {
equation = new SquareEquation();
textA = new JTextField(8);
textB = new JTextField(8);
textC = new JTextField(8);
controlButton = new JButton("确定");
JPanel