ÇöÀç±îÁöÀÇ Á¦¼Ò½ºÀÔ´Ï´Ù.


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :Áöâȯ 1999³â 10¿ù 27ÀÏ 12:32:51

In Reply to: ±¸Ã¼ÀûÀ¸·Î...? posted by ±èÇÊÈ£ on 1999³â 10¿ù 27ÀÏ 11:33:03:

ÇöÀç Á¦°¡ °¡Áö°í ÀÖ´Â ¼Ò½º¿¡´Ù°¡ ½ºÅÃÀ» »ç¿ëÇؼ­
°è»ê±â¸¦ ¸¸µå´Â°ÍÀÔ´Ï´Ù.



import java.awt.Color;
import java.awt.BorderLayout;
import java.awt.event.*;
import javax.swing.*;


class Calc extends JFrame
implements ActionListener {


JLabel result;
JButton one,two,three,four,five,six,seven,eight,nine,zero,plus,minus,mult,slash,equal;
JPanel hpane;


Calc(){ //Begin Constructor


int a10=10, a20=60, a30=110, a40=160,a50=210,a60=260;
int b10=10, b20=60, b30=110, b40=160,b50=210,b60=260;

int w30=50,h15=50;


hpane = new JPanel();
hpane.setLayout(null);
hpane.setBackground(Color.white);
getContentPane().add(hpane);


//hpane.setLayout(null);


result = new JLabel("¾×Á¤È­¸é");
hpane.add(result);
result.reshape(a20,b10,100,h15);


seven = new JButton("7");
hpane.add(seven);
seven.reshape(a10,b20,w30,h15);
seven.addActionListener(this);


eight = new JButton("8");
hpane.add(eight);
eight.reshape(a20,b20,w30,h15);
eight.addActionListener(this);


nine = new JButton("9");
hpane.add( nine);
nine.reshape(a30,b20,w30,h15);
nine.addActionListener(this);


/* */
four = new JButton("4");
hpane.add(four);
four.reshape(a10,b30,w30,h15);
four.addActionListener(this);


five = new JButton("5");
hpane.add( five);
five.reshape(a20,b30,w30,h15);
five.addActionListener(this);


six = new JButton("6");
hpane.add(six);
six.reshape(a30,b30,w30,h15);
six.addActionListener(this);


/* */
one = new JButton("1");
hpane.add(one);
one.reshape(a10,b40,w30,h15);
one.addActionListener(this);


two = new JButton("2");
hpane.add(two);
two.reshape(a20,b40,w30,h15);
two.addActionListener(this);


three = new JButton("3");
hpane.add(three);
three.reshape(a30,b40,w30,h15);
three.addActionListener(this);


/* */
plus = new JButton("+");
hpane.add(plus);
plus.reshape(a10,b50,w30,h15);
plus.addActionListener(this);


zero = new JButton("0");
hpane.add(zero);
zero.reshape(a20,b50,w30,h15);
zero.addActionListener(this);


minus = new JButton("-");
hpane.add(minus);
minus.reshape(a30,b50,w30,h15);
minus.addActionListener(this);
/* */
mult = new JButton("x");
hpane.add(mult);
mult.reshape(a10,b60,w30,h15);
mult.addActionListener(this);


equal = new JButton("=");
hpane.add(equal);
equal.reshape(a20,b60,w30,h15);
equal.addActionListener(this);

slash = new JButton("/");
hpane.add(slash);
slash.reshape(a30,b60,w30,h15);
slash.addActionListener(this);


} //End Constructor



public void actionPerformed(ActionEvent event) {
JButton btn = (JButton) event.getSource();
result.setText(btn.getText()+"");

}


// start of main
public static void main(String[] args){
Calc frame = new Calc();
frame.setTitle("°è»ê±â");
WindowListener l = new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
};


frame.addWindowListener(l);
frame.pack();
frame.setSize(200,350);
frame.setVisible(true);
}
// end of main


}



´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
HTML ÅÂ±× Æ÷ÇÔ ¿©ºÎ: HTML ¹®¼­ÀÏ °æ¿ì üũ
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]