Page 869 - 2
P. 869

나. Eclipse  에서 데이터 처리를 위한 프로그램 소스


            STEP1. Tetris   게임을 실행하기위한 main          함수가 정의되어 있는 클래스
            Tetris.class
            package tetris;
            import java.awt.BorderLayout;


            import javax.swing.JFrame;
            import javax.swing.JLabel;




            public class Tetris extends JFrame {


                JLabel statusbar;
                JLabel statusbar1;


                public Tetris() {


                    statusbar = new JLabel("score 0");
                    statusbar1 = new JLabel("speed 400");
                    add(statusbar1,BorderLayout.NORTH);
                    add(statusbar, BorderLayout.SOUTH);
                    Board board = new Board(this);
                    add(board);
                    board.start();


                    setSize(200, 400);
                    setTitle("Tetris");
                    setDefaultCloseOperation(EXIT_ON_CLOSE);
               }


               public JLabel getStatusBar() {
                   return statusbar;
               }


               public JLabel getStatusBar1(){
                       return statusbar1;
               }


                public static void main(String[] args) {


                    Tetris game = new Tetris();
                    game.setLocationRelativeTo(null);
                    game.setVisible(true);




                                                         - 869 -
   864   865   866   867   868   869   870   871   872   873   874