import java.awt.*;
import javax.swing.*;
public class Calculator extends JFrame {
public Calculator(){
JPanel p1 = new JPanel();
p1.setLayout(new GridLayout(4,3));
for(int i=1;i<=9;i++){
p1.add(new JButton(""+i));
}
p1.add(new JButton("."));
p1.add(new JButton(""+0));
p1.add(new JButton("enter"));
JPanel p2 = new JPanel(new BorderLayout());
p2.setLayout(new GridLayout(4,1));
p2.add(new JButton("/"));
p2.add(new JButton("*"));
p2.add(new JButton("-"));
p2.add(new JButton("+"));
p1.add(p2,BorderLayout.EAST);
p2.add(new JTextField("data"),BorderLayout.NORTH);
add(p2,BorderLayout.NORTH );
add(p1,BorderLayout.CENTER);
}
public static void main(String[] a){
Calculator frame = new Calculator();
frame.setTitle("MYFRAME");
frame.setSize(800,400);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
http://yuncode.net/code/c_50b0c000f0c2e62