所以我正在编写一个程序来解决二次方程式,并且在制作2个JLabel(以前为空)显示答案时,一切都有效(当用户单击JButton时会发生这种情况)
这是整个程序,因为我不知道错误在哪里.
import java.awt.event.*;
import javax.swing.*;
public class Third implements ActionListener {
//--------------
//Data Members
//--------------
/**
* Top level window
*/
JFrame top;
/**
* Changed into a string by ConvertToDouble(string str);
*/
double a, b, c;
double answer1,answer2;
JTextField inputA, inputB, inputC;
JLabel describeA, describeB, describeC, print1, print2;
JButton submit;
String aa, bb, cc;
String result1, result2;
String strA, strB, strC;
public Third(){
top = new JFrame("Ned's quadratic equation solver");
top.setVisible(true);
top.setLayout(null);
top.setBounds(50,50,250,250);
inputA = new JTextField(12);
inputA.setBounds(100,30,200,25); …Run Code Online (Sandbox Code Playgroud)