Java The Complete Reference, Seventh Edition
Insiderun( ), the characters in the string contained inmsgare repeatedly rotated left. Between each rotation, a call torepaint( ...
Chapter 21: The Applet Class 629 The HTML APPLET Tag As mentioned earlier, Sun currently recommends that the APPLET tag be used ...
630 Part II: The Java Library ALIGN ALIGN is an optional attribute that specifies the alignment of the applet. This attribute is ...
Chapter 21: The Applet Class 631 fontSize = 0; } catch(NumberFormatException e) { fontSize = -1; } param = getParameter("leading ...
632 Part II: The Java Library import java.applet.*; /* <applet code="ParamBanner" width=300 height=50> <param name=mess ...
// Display the banner. public void paint(Graphics g) { g.drawString(msg, 50, 30); } } getDocumentBase( ) and getCodeBase( ) Ofte ...
AppletContext and showDocument( ) One application of Java is to use active images and animation to provide a graphical means of ...
Chapter 21: The Applet Class 635 The AudioClip Interface TheAudioClipinterface defines these methods:play( )(play a clip from th ...
Outputting to the Console Although output to an applet’s window must be accomplished through GUI-based methods, such asdrawStrin ...
637 22 Event Handling T his chapter examines an important aspect of Java: the event. Event handling is fundamental to Java progr ...
638 Part II: The Java Library The Delegation Event Model The modern approach to handling events is based on thedelegation event ...
Chapter 22: Event Handling 639 Some sources may allow only one listener to register. The general form of such a method is this: ...
The classAWTEvent, defined within thejava.awtpackage, is a subclass ofEventObject. It is the superclass (either directly or indi ...
Chapter 22: Event Handling 641 ActionEventhas these three constructors: ActionEvent(Objectsrc, inttype, Stringcmd) ActionEvent(O ...
642 Part II: The Java Library The type of the adjustment event may be obtained by thegetAdjustmentType( )method. It returns one ...
Container getContainer( ) ThegetChild( )method returns a reference to the component that was added to or removed from the contai ...
644 Part II: The Java Library However, because of possible conflicts between the modifiers used by keyboard events and mouse eve ...
Chapter 22: Event Handling 645 ThegetItemSelectable( )method can be used to obtain a reference to theItemSelectable object that ...
646 Part II: The Java Library The MouseEvent Class There are eight types of mouse events. TheMouseEventclass defines the followi ...
Chapter 22: Event Handling 647 boolean isPopupTrigger( ) Also available is thegetButton( )method, shown here: int getButton( ) I ...
«
29
30
31
32
33
34
35
36
37
38
»
Free download pdf