1このプログラムの全てのインスタンス変数について、変数名を書いてください。 2全てのメソッド名を書いてください。 よろしくお願いします。 1: import java.awt.event.*; 2: import java.awt.*; 3: import java.io.*; 4: import java.net.*; 5: 6: public class Test71 { 7: private MyCanvas c; 8: public static void main( String[] args ) { 9: Test71 t71 = new Test71(); 10: t71.doEvent(); 11: } 12: 13: Test71() { 14: Frame f = new Frame( "Test71" ); 15: f.setSize( 640, 480 ); 16: f.addWindowListener( new WindowAdapter() { 17: @Override public void windowClosing( WindowEvent e ) { 18: System.exit( 0 ); 19: } 20: }); 21: c = new MyCanvas(); 22: f.add( c ); 23: f.setVisible( true ); 24: } 25: 26: public void doEvent(){ 27: try{ 28: ServerSocket ss = new ServerSocket( 8000 ); 29: while( true ) { 30: Socket socket = ss.accept(); 31: BufferedReader br = new BufferedReader( new InputStreamReader( socket.getInputStream() ) ); 32: BufferedWriter bw = new BufferedWriter( new OutputStreamWriter( socket.getOutputStream() ) ); 33: while( true ) { 34: String command = br.readLine(); 35: String[] words = command.split( " " ); 36: System.out.println( command ); 37: if( words[0].equalsIgnoreCase( "setOval" ) ) { 38: try { 39: c.setPoint( Integer.parseInt( words[1] ), Integer.parseInt( words[2] ) ); 40: } catch( Exception e ) {} 41: } else if( words[0].equalsIgnoreCase( "changeMode" ) ) { 42: //描画方式を変更する処理 43: } 44: else if( words[0].equalsIgnoreCase( "quit" ) ) { 45: break; 46: } 47: } 48: bw.close(); 43 49: br.close(); 50: socket.close(); 51: } 52: } catch( Exception e ) { 53: e.printStackTrace(); 54: } 55: } 56: }
↧