Java The Complete Reference, Seventh Edition
608 Part II: The Java Library String getHeaderField(intidx) Returns the value of the header field at indexidx. (Header field ind ...
Chapter 20: Networking 609 // get expiration date d = hpCon.getExpiration(); if(d==0) System.out.println("No expiration informat ...
610 Part II: The Java Library <styletype="text/css"> <!-- p, li, td, ul { font-family: Arial, Helvetica, sans-serif} -- ...
Chapter 20: Networking 611 public static void main(String args[]) throws Exception { URL hp = new URL("http://www.google.com"); ...
612 Part II: The Java Library Notice how the header keys and values are displayed. First, a map of the header keys and values is ...
Chapter 20: Networking 613 ServerSockethas a method calledaccept( ), which is a blocking call that will wait for a client to ini ...
614 Part II: The Java Library Other methods give you access to various attributes associated with aDatagramSocket. Here is a sam ...
int getOffset( ) Returns the starting index of the data. int getPort( ) Returns the port number. void setAddress(InetAddressipAd ...
public static void TheClient() throws Exception { while(true) { DatagramPacket p = new DatagramPacket(buffer, buffer.length); ds ...
21 The Applet Class 21 The Applet Class T his chapter examines theAppletclass, which provides the foundation for applets. TheApp ...
mechanism, which will be explained shortly. Output to your applet’s window is not performed bySystem.out.println( ). Rather, in ...
Chapter 21: The Applet Class 619 Method Description AudioClip getAudioClip(URLurl, StringclipName) Returns anAudioClipobject tha ...
Applet Architecture An applet is a window-based program. As such, its architecture is different from theconsole-based programs s ...
Chapter 21: The Applet Class 621 An Applet Skeleton All but the most trivial applets override a set of methods that provides the ...
622 Part II: The Java Library Although this skeleton does not do anything, it can be compiled and run. When run, it generates th ...
Chapter 21: The Applet Class 623 probably running. You should usestop( )to suspend threads that don’t need to run when the apple ...
624 Part II: The Java Library Color.gray Color.white Color.green Color.yellow Color.lightGray Uppercase versions of the constant ...
Chapter 21: The Applet Class 625 This applet generates the window shown here: The methodsstop( )anddestroy( )are not overridden, ...
626 Part II: The Java Library including animation, in which a consistent update time is necessary. One solution to this problem ...
Chapter 21: The Applet Class 627 } // Entry point for the thread that runs the banner. public void run() { char ch; // Display b ...
«
28
29
30
31
32
33
34
35
36
37
»
Free download pdf