giáo trình Java By Example phần 5 ppt
... RECTAPPLET .JAVA: Drawing Rectangles. import java. awt.*; import java. applet.*; public class RectApplet extends Applet { public void paint(Graphics g) { g.drawRect( 35, 15, 1 25, 200); g.fillRoundRect (50 , ... each X,Y pair. By looking at the values defined in the arrays, you can see that the first line gets drawn from 35, 50 to 150 ,80. Because all the lines in a polygon are connec...
Ngày tải lên: 22/07/2014, 16:21
... the original Java- compatible Web browser. java This is the Java interpreter, which runs applets and applications by reading and interpreting byte-code .CLASS files. javac This is the Java compiler, ... fact, you can write the simplest Java applet in only a few lines of code, as shown in Listing 15. 1. Listing 15. 1 MyApplet .java: The Simplest Java Applet. import java. applet.*...
Ngày tải lên: 22/07/2014, 16:21
... g.drawRect (52 , 52 , width+10, height+10); g.drawImage(snake, 57 , 57 , width, height, this); } } Tell Java that the applet uses the classes in the awt package. Tell Java that the applet ... the MS-DOS prompt, type javac DisplayClass .java. Java& apos;s compiler then compiles the DisplayClass .java file, creating the DisplayClass.class file in your DISPLAY folder. 5. As you can...
Ngày tải lên: 22/07/2014, 16:21
giáo trình Java By Example phần 10 pps
... source is a string. Example: Reading a File There are many ways to read files using Java& apos;s I/O classes. The most basic, however, is to read a file byte -by- byte. Suppose, for example, you wanted ... following: java. lang● java. util● java. io● The second group is called the HotJava packages and includes the libraries needed to create applets and to communicate over the Internet....
Ngày tải lên: 22/07/2014, 16:21
giáo trình Java By Example phần 7 docx
... a value of 5. Then, thanks to the x+ =5 statement, the loop variable is incremented by 5 each time through the loop. Therefore, x goes from 5 to 10, from 10 to 15, and so on up to 50 , resulting ... g.drawString(s, 50 +x* 25, 50 +y* 15) ; } } } Tell Java that the program uses classes in the awt package. Tell Java that the program uses classes in the applet package. Derive the...
Ngày tải lên: 22/07/2014, 16:21
giáo trình Java By Example phần 6 pps
... change the second and third arguments. For example, Figure 6.4 shows the text positioned at 25, 25. Figure 6.4 : Here, Applet1 displays the text at position 25, 25. Getting Input from the User Again, ... APPLET 15. htmL: Applet 15& apos;s HTML Document. <title>Applet Test Page</title> <h1>Applet Test Page</h1> <applet code="Applet 15. class" width= 25...
Ngày tải lên: 22/07/2014, 16:21
giáo trình Java By Example phần 4 pot
... g.drawString(s, 50 , 50 ); s = "Family: " + family; g.drawString(s, 50 , 65) ; s = "Style: " + style; g.drawString(s, 50 , 80); s = "Size: " + size; g.drawString(s, 50 , 95) ; ... Checkbox("The Adventures of Javaman", null, false); checkbox2 = new Checkbox(" ;Java by Example& quot;, null, false); checkbox3 = new Checkbox(" ;Jav...
Ngày tải lên: 22/07/2014, 16:21
giáo trình Java By Example phần 3 pot
... Controls CONTENTS Choice Menus Example: Creating a Choice Menu❍ Choice Menu Methods❍ Example: Responding to Menu Events in an Applet❍ ● Scrolling Lists Example: Creating a Single-Selection List❍ Example: Creating ... Clicking the button switches the manager to a new card. Listing 22 .5 CardApplet .java: Using a CardLayout Manager. import java. awt.*; import java. applet.*; public cl...
Ngày tải lên: 22/07/2014, 16:21
giáo trình Java By Example phần 2 pdf
... Figure 25. 1 shows MouseApplet running under Appletviewer. Figure 25. 1 : The MouseApplet applet responds to mouse clicks. Listing 25. 1 MouseApplet .java: Using Mouse Clicks in an Applet. import java. awt.*; import ... has the focus and will receive the key presses. Listing 25. 3 KeyApplet .java: An Applet That Captures Key Presses. import java. awt.*; import java. applet.*; public class...
Ngày tải lên: 22/07/2014, 16:21
giáo trình Java By Example phần 1 ppsx
... Wonderful World of Java Chapter 1 Java Overview The Java Story● Introducing Java Java Programs● The Java Developer's Kit● Where Is Java? ● Example: Installing HotJava● Example: Installing ... Glossary Appendix C IDEs and Tools IDEs Diva❍ Java+ ❍ JavaMaker❍ ● Tools AppletGen❍ VbToJava❍ PortaFilter❍ ● Summary● Credits Java By Example Copyright© 1996 by Que...
Ngày tải lên: 22/07/2014, 16:21