packageguijisuanji;importjavax.swing.*;importjava.awt.*;publicclassJFrameClassextendsJFrame{publicJFrameClass(){setTitle("计算器");Containercontentpane=getContentPane();J...
package guijisuanji;
import javax.swing.*;
import java.awt.*;
public class JFrameClass extends JFrame {
public JFrameClass (){
setTitle ("计算器");
Container contentpane=getContentPane();
JpanelClass panel=new JpanelClass();
contentpane.add(panel);
setSize(250,250);
setVisible(true);
setResizable(false);
}
}
package guijisuanji;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class JpanelClass extends JPanel {
private JLabel display;
private JPanel panel;
private double result;
private String lastCommand;
private boolean start;
//String[] str={"0","1","2","3","4","5","6","7","8","9",".","+","-","*","/","="};
//JButton [] button;
public JpanelClass (){
setLayout(new BorderLayout());
result =0;
lastCommand ="=";
start =true;
display=new JLabel("0",SwingConstants.RIGHT);
add(display,BorderLayout.NORTH);
panel =new JpanelClass ();
没法截完,问题就出在panel =new JpanelClass (); 求解怎么改···
Exception in thread "main" java.lang.StackOverflowError
展开