用Java编写计算器,代码展示!
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
public class ButtonArrayExample extends JFrame { // 继承窗体类JFrame
/**
*
*/
private static final long serialVersionUID = 6626440733001287873L;
private JTextField textField;
public static void main(String args[]) {
try {
UIManager.setLookAndFeel("");
} catch (Throwable e) {
e.printStackTrace();
}
ButtonArrayExample frame = new ButtonArrayExample();
frame.setVisible(true); // 设置窗体可见,默认为不可见
}
public ButtonArrayExample() {
super(); // 继承父类的构造方法