import java.awt.BorderLayout;import java.awt.EventQueue;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class Calculartor 
{
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
CalculartorFrame frame = new CalculartorFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
});
}}class CalculartorFrame extends JFrame
{
public CalculartorFrame()
{
setSize(DEFAULT_WIDTH ,DEFAULT_HEIGHT);
setTitle("Calculartor");

 display = new JButton("0");
add(display, BorderLayout.NORTH);
display.setEnabled(false);

panel = new JPanel();
panel.setLayout(new GridLayout(4, 4));

 button = new NewButton("9", command);
 button = new NewButton("8", command);
 button = new NewButton("7", command);
     button = new NewButton("/", insert );

button = new NewButton("6", command);
button = new NewButton("5", command);
button = new NewButton("4", command);
button = new NewButton("*", insert);

button = new NewButton("3", command);
button = new NewButton("2", command);
button = new NewButton("1", command);
button = new NewButton("-", insert);

button = new NewButton("0", command);
button = new NewButton(".", insert);
button = new NewButton("=", insert);
button = new NewButton("+", insert);



add(panel, BorderLayout.CENTER);
pack();

}

private class NewButton extends JButton
{
public NewButton(String t, ActionListener action)
{
super(t);
addActionListener(action);
panel.add(NewButton.this);
}
}

private class commandAction extends AbstractAction
{ @Override
public void actionPerformed(ActionEvent event) 
{
System.out.println("dfdf");
}

}

private class insertAction extends AbstractAction
{
public void actionPerformed(ActionEvent event)
{
  
}
}

private JPanel panel;
private NewButton button;
private JButton display;

private commandAction command;
private insertAction insert;
public static final int DEFAULT_WIDTH = 400;
public static final int DEFAULT_HEIGHT = 300;
}