Source of DeitelMessenger.java


  1: // Fig. 24.29: DeitelMessenger.java
  2: // DeitelMessenger is a chat application that uses a ClientGUI
  3: // and SocketMessageManager to communicate with DeitelMessengerServer.
  4: package com.deitel.messenger.sockets.client;

  6: import com.deitel.messenger.MessageManager;
  7: import com.deitel.messenger.ClientGUI;

  9: public class DeitelMessenger
 10: {   
 11:    public static void main( String args[] ) 
 12:    {
 13:       MessageManager messageManager; // declare MessageManager
 14:       
 15:       if ( args.length == 0 )
 16:          // connect to localhost
 17:          messageManager = new SocketMessageManager( "localhost" );
 18:       else
 19:          // connect using command-line arg
 20:          messageManager = new SocketMessageManager( args[ 0 ] );  
 21:       
 22:       // create GUI for SocketMessageManager
 23:       ClientGUI clientGUI = new ClientGUI( messageManager );
 24:       clientGUI.setSize( 300, 400 ); // set window size
 25:       clientGUI.setResizable( false ); // disable resizing
 26:       clientGUI.setVisible( true ); // show window
 27:    } // end main
 28: } // end class DeitelMessenger


 31: /**************************************************************************
 32:  * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and               *
 33:  * Pearson Education, Inc. All Rights Reserved.                           *
 34:  *                                                                        *
 35:  * DISCLAIMER: The authors and publisher of this book have used their     *
 36:  * best efforts in preparing the book. These efforts include the          *
 37:  * development, research, and testing of the theories and programs        *
 38:  * to determine their effectiveness. The authors and publisher make       *
 39:  * no warranty of any kind, expressed or implied, with regard to these    *
 40:  * programs or to the documentation contained in these books. The authors *
 41:  * and publisher shall not be liable in any event for incidental or       *
 42:  * consequential damages in connection with, or arising out of, the       *
 43:  * furnishing, performance, or use of these programs.                     *
 44:  *************************************************************************/