Page 849 - 3-2
P. 849

try {
                                            SenserThread.senser();


                                    } catch (InterruptedException e) {
                                            // TODO Auto-generated catch block
                                            e.printStackTrace();
                                    }
                            }
                    });


                    button1.setBounds(14, 12, 155, 36);
                    contentPane.add(button1);


                    JButton button2 = new JButton("2");


                    button2.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                    sendMsg("2");
                                    //Speaker sp = new Speaker();
                                    //sp.start();
                            }
                    });


                    button2.setBounds(183, 17, 155, 31);
                    contentPane.add(button2);


                    textField = new JTextField();
                    textField.setBounds(25, 83, 258, 72);
                    contentPane.add(textField);
                    textField.setColumns(10);


                    ServerMain sm = new ServerMain();
                    sm.start();
              }
            }





            /*
             * ServerThread  클래스는 Thread    클래스를 상속받은 클래스로서 하나의 독립된 실행주체가 된다.

             *  개개의 클라이언트를 응대하기 위한 클래스이다.
             *  클래스: ServerThread
             *  필드: srv(ServerMain), sock(Socket)
             *  생성자: ServerThread()


                                                         - 849 -
   844   845   846   847   848   849   850   851   852   853   854