import java.awt.*;
//계산기
class MyFrame12 extends Frame{
private String bt[] = {"7","8","9","/",
"4","5","6","*",
"1","2","3","-",
"#","0","*","+"};
private Label lb= new Label("계산기",Label.CENTER);
private Panel p1 = new Panel();
private Panel p2 = new Panel();
private BorderLayout bl = new BorderLayout();
private GridLayout gl = new GridLayout(4,4);
public void init(){
this.add("North",p1);
this.add("Center",p2);
p1.add(lb);
p2.setLayout(gl);
for(int i=0; i<bt.length; ++i){
bt[i] = new String();
}
}
MyFrame12(String title){
super(title);
this.init();
this.setSize(400,300);
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
int xpos = (int)(screen.getWidth()/2 - this.getWidth()/2);
int ypos = (int)(screen.getHeight()/2 - this.getHeight()/2);
this.setLocation(xpos,ypos);
this.setResizable(false);
this.setVisible(true);
}
}
public class Exam_12 {
public static void main(String[] args) {
MyFrame12 mf = new MyFrame12("awt실습");
}
}
댓글 0