Archive for: September, 2014

Reading initialization Parameter

Reading initialization Parameter  You can provide initialization parameters to a servict. These call be used-to open files create database connections, or perform other actions. Tl.is information can be accessed in two ways: The init( ) method declared by the Servlet interface receives. a Servletconfig object as its argument. This object provides methods that enable you to read the initialization…

Read More →

Reading Servlet Parameters

Reading Servlet Parameters The ServletRequest class includes methods that allow you to read the names and values of parameters that arc included in a client ,request. We will develop a servlet that illustrates their use. The example contains two files: Post Parameters.htm defines a Web page, and Post Parameters Servlet.java defines a servlet. The HTML source code for Post…

Read More →

ServerConnection.java

ServerConnection.java The last class in the-client side of this applet is ScrvcrConnccticn, which encapsulates the communication with the server and our opponent. There arc several variables declared at the beginning of the class. The socket port Humber 10 attach to on the server. is 6564. CRLF is tile Internet constant string representing end-of-line. The I/O streams from and to…

Read More →

Instance Varibles

Instance Variables The valid flag is used to make si re that all of the sizing variables are set up exactly once, the first time this Letter is painted. There are several variables cached hereto keep from having to do lots of computation each time the applet paints-such as, xO, wO,xsO,wsO, and gap-which are all explained…

Read More →

accept()

accept() accept( ) is the method called on the remote side in response to the server.accept ) call just mentioned, Just <IS the other player deleted hims,elf .or herself from the list of.available players, so must we call server.delete( ). We take the first turn by setting. chat( ) The chat( ) method is called…

Read More →

mouseDragged( )

mouseDragged( ) The mouse Dragged( ) method is called when the mouse moves with any of its.p~tt6ns pressed. In this applet, we want to do the same thIng on drag or move, so we just call mouseMoved( ) directly, passing in the same parameters we received. mouseMoved( ) Whenever the mouse moves; mouseMoved( ) checks the y…

Read More →

paint( )

paint( ) The paint () method is quite simple. First, it checks to seen the offscreen buffer has been created. yet. If it hasn’t, lateInit( ) is called to create the buffer and load the menu image. After that, it draws the left half of the image on the offscreen buffer. This requires, of course, that the…

Read More →

init( )

init( ) When the applet is being initialized, init( ) saves the size in the Dlmc Siun Variable d and parses the applet param tags. It then uses a String Tokenizer to parse strings delimited by the plus sign to create the string arrays url and target. The number of URLs that arc parsed is the number that…

Read More →

The Source Image

The Source Image While you won’t see the code for Navigation here, looking at its GIF image and APPLET tag shows clearly what Image Menu is going to do. The source image for Navigation in Figure 30-2 shows seven columns, each of which provides a visual representation of a possible selection. However, each selectable item only has two states,…

Read More →

Image Menu: An Image Based Web Menu

Image Menu: An Image Based Web Menu The Image Menu applet is a simple program that presents an image-based menu with an arbitrary number of choices in a vertical list, When the user-moves the mouse cursor, over these choices, the one.under the cursor changes appearance, indicating that it can be clicked on. When the user clicks on a…

Read More →

Back to Top