!!!!!!!!!!!! ClickListener.java A simple subclass of MouseAdapter that reports where the mouse was pressed. When attached to an applet, look for the report in the Java Console. !!!!!!!!!!!! import java.awt.event.*; /** The listener used by ClickReporter. * ************** public class ClickListener extends MouseAdapter { public void mousePressed(MouseEvent event) { System.out.println("Mouse pressed at (" + event.getX() …
Category: FromSitesTree.com
Apr 30
# RMI Example – Numerical Integration, a more realistic RMI example that sends an evaluatable object (function) from a client to a server for numerical integration. #Programming Code Examples #Java/J2EE/J2ME #Network Programming
# RMI Example – Numerical Integration, a more realistic RMI example that sends an evaluatable object (function) from a client to a server for numerical integration. Integral.java Performs actual numerical integration of the function (evaluatable object). /** A class to calculate summations and numeric integrals. The * integral is calculated according to the midpoint rule. …
Apr 30
RMI Example – Message, illustrates retrieving a message from an object located on a remote server. Requires the following classes: #Programming Code Examples #Java/J2EE/J2ME #Network Programming
RMI Example – Message, illustrates retrieving a message from an object located on a remote server. Requires the following classes: Rem.java Establishes which methods the client can access in the remote object. import java.rmi.*; /** The RMI client will use this interface directly. The RMI * server will make a real remote object that implements …
Apr 30
EchoServer.java A simple HTTP server that creates a Web page showing all data sent from the client (browser), including all HTTP request headers sent form the client. Uses the following classes: #Programming Code Examples #Java/J2EE/J2ME #Network Programming
EchoServer.java A simple HTTP server that creates a Web page showing all data sent from the client (browser), including all HTTP request headers sent form the client. Uses the following classes: import java.net.*; import java.io.*; import java.util.StringTokenizer; /** A simple HTTP server that generates a Web page showing all * of the data that it …
Apr 30
ThreadedEchoServer.java A multithreaded version of EchoServer, where each client request is serviced on a separate thread. Requires the following classes: #Programming Code Examples #Java/J2EE/J2ME #Network Programming
ThreadedEchoServer.java A multithreaded version of EchoServer, where each client request is serviced on a separate thread. Requires the following classes: import java.net.*; import java.io.*; /** A multithreaded variation of EchoServer. * * Taken from Core Web Programming from * Prentice Hall and Sun Microsystems Press, * . * © 2001 Marty Hall and Larry Brown; …
Apr 29
WebClient – Client application that can talk interactively to Web servers. Requires the components listed below #Programming Code Examples #Java/J2EE/J2ME #Network Programming
WebClient – Client application that can talk interactively to Web servers. Requires the components listed below import java.awt.*; // For BorderLayout, GridLayout, Font, Color. import java.awt.event.*; import java.util.*; import javax.swing.*; /** A graphical client that lets you interactively connect to * Web servers and send custom request lines and * request headers. * * Taken …
Apr 29
Implementing a Server : Network Server #Programming Code Examples #Java/J2EE/J2ME #Network Programming
NetworkServerTest.java Establishes a network Server that listens for client requests on the port specified (command-line argument). Uses the following classes: /** Taken from Core Web Programming from * Prentice Hall and Sun Microsystems Press, * . * © 2001 Marty Hall and Larry Brown; * may be freely used or adapted. */ public class NetworkServerTest …
Apr 29
AddressVerifier.java Connects to an SMTP server and issues a expn request to display details about a mailbox on the server. Uses the following classes: #Programming Code Examples #Java/J2EE/J2ME #Network Programming
AddressVerifier.java Connects to an SMTP server and issues a expn request to display details about a mailbox on the server. Uses the following classes: import java.net.*; import java.io.*; /** Given an e-mail address of the form user@host, * connect to port 25 of the host and issue an * ‘expn’ request for the user. Print …
Apr 29
UrlRetriever.java Accepts an URL from the command line, parses the host, port, and URI components from the URL and then retrieves the document. Requires the following classes: #Programming Code Examples #Java/J2EE/J2ME #Network Programming
UrlRetriever.java Accepts an URL from the command line, parses the host, port, and URI components from the URL and then retrieves the document. Requires the following classes: import java.util.*; /** This parses the input to get a host, port, and file, then * passes these three values to the UriRetriever class to * grab the …
Apr 29
UrlRetriever2.java Illustrates how the URL class can simplify communication to an HTTP server. #Programming Code Examples #Java/J2EE/J2ME #Network Programming
UrlRetriever2.java Illustrates how the URL class can simplify communication to an HTTP server. import java.net.*; import java.io.*; /** Read a remote file using the standard URL class * instead of connecting explicitly to the HTTP server. * * Taken from Core Web Programming from * Prentice Hall and Sun Microsystems Press, * . * © …
