freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

java語(yǔ)言程序設(shè)計(jì)(下)ppt(已修改)

2025-01-31 08:08 本頁(yè)面
 

【正文】 1 Java語(yǔ)言程序設(shè)計(jì) 馬 皓 2 第四章 Applet及其應(yīng)用 1. Applet概述 2. Applet類 3. Applet程序與 HTML文件 4. Applet的應(yīng)用 3 Applet概述 ? Java程序的兩種基本形式 ? Java Application(應(yīng)用程序 ),可獨(dú)立運(yùn)行 ? Java Applet(小程序 ),嵌入在瀏覽器中運(yùn)行 ? 介紹 ? Applet的結(jié)構(gòu)特點(diǎn)、實(shí)現(xiàn)方法、工作原理 ? 掌握 ? Applet的編輯、編譯和運(yùn)行方法 4 一個(gè) Applet小程序的例子 import 。 import 。 public class Exam4_1 extends Applet { String str。 public void init() { str = “Here is an Applet”。 } public void paint(Graphics g) { (str, 100, 100)。 } } 5 HTML文件 ? 超文本標(biāo)記語(yǔ)言 (HTML) ? WWW瀏覽器 ? Applet小程序 ? 嵌入在 /寫入在 HTML文件中 ? 從 WWW服務(wù)器下載到本地 WWW瀏覽器 ? 由 WWW瀏覽器中的 Java解釋器來(lái)運(yùn)行 6 HTML文件 ? 實(shí)現(xiàn)過(guò)程 ? Applet小程序編寫,編譯,得到字節(jié)碼文件 ? javac ? 嵌入到 HTML文件中,保存為 ? Html ? Body ? Applet code=―‖ width=300 height=200 ? /Applet ? /Body ? /Html 7 HTML文件 ? 瀏覽器打開 8 Applet的特點(diǎn) ? 通常作為 Applet類的子類,格式如下 : public class 類名 extends Applet { ……… } ? 嵌入在 HTML文件中,利用 WWW瀏覽器或 Appletviewer來(lái)運(yùn)行 ? 利用了 WWW瀏覽器或 Appletviewer所提供的圖形用戶界面功能 9 Applet的工作原理 Applet源程序 字節(jié)碼文件 嵌入到 HTML文件 WWW瀏覽器打開 該 HTML文件 10 第四章 Applet及其應(yīng)用 1. Applet概述 2. Applet類 3. Applet程序與 HTML文件 4. Applet的應(yīng)用 11 Applet類的繼承關(guān)系 默認(rèn)情況下, Applet類 使用 FlowLayout布局管理器 12 Applet類的主要方法 1. init()方法 ? 完成初始化操作 ? 在 Applet程序第一次加載時(shí)調(diào)用,僅執(zhí)行一次 2. start()方法 ? 啟動(dòng) Applet主線程運(yùn)行 ? 重啟時(shí)也被調(diào)用 (reload或返回 ) 3. paint()方法 ? 將結(jié)果輸出 /繪制到界面上 ? 被自動(dòng)調(diào)用 (啟動(dòng)后 /窗口改變 /repaint()調(diào)用 ) 13 Applet類的主要方法 4. stop()方法 ? 暫停 Applet程序執(zhí)行 5. destroy()方法 ? 終止 Applet程序執(zhí)行,釋放所占用的資源 14 Applet類的主要方法 import 。 import .*。 public class Exam extends Applet { public void init( ) { //初始化 Applet程序 ……… } public void start( ) { //啟動(dòng) Applet線程 ……… } public void paint(Graphics g) { //繪制輸出顯示信息 ……… } public void stop( ) { //暫停線程 ……… } public void destroy( ) { //釋放系統(tǒng)資源,結(jié)束線程 ……… } } 15 第四章 Applet及其應(yīng)用 1. Applet概述 2. Applet類 3. Applet程序與 HTML文件 4. Applet的應(yīng)用 16 HTML文件 ? 超文本標(biāo)記語(yǔ)言 (HTML) ? Html和 /Html ? Html文件開始和結(jié)束的標(biāo)記 ? Head和 /Head ? WWW瀏覽器窗口標(biāo)題內(nèi)容的標(biāo)記 ? Body和 /Body ? Html文件在瀏覽器窗口中顯示內(nèi)容的標(biāo)記 ? Applet和 /Applet ? 嵌入到 Html文件中 Applet程序的標(biāo)記 17 Applet程序的標(biāo)記 ? Applet code=―字節(jié)碼文件 (*.class)‖ width=寬度值 height=高度值 ? /Applet ? 參數(shù) ? Param name=參數(shù)名稱 value=參數(shù)值 18 Applet小程序 import 。 import .*。 public class Exam4_3 extends Applet { String str。 int x, y, h。 Font fnt。 public void init() { str = getParameter(“string”)。 h = (getParameter(“size”))。 x = (getParameter(“x1”))。 y = (getParameter(“y1”))。 fnt = new Font(“TimesRoman”, , h)。 } public void paint(Graphics g) { ()。 (fnt)。 (str, x, y)。 } } 19 Applet小程序 Html Body Applet code=“” width=300 height=200 Param name=“string” value=“Hello, Beijing!” Param name=“size” value=“30” Param name=“x1” value=“50” Param name=“y1” value=“100” /Applet /Body /Html 20 第四章 Applet及其應(yīng)用 1. Applet概述 2. Applet類 3. Applet程序與 HTML文件 4. Applet的應(yīng)用 21 繪制圖形 1. 設(shè)臵字體 ? ? 設(shè)臵文本的字體 (包括字型和字號(hào) ) ? 構(gòu)造方法 ? public Font(String name, int style int size) 2. 設(shè)臵顏色 ? ? 控制顏色, Color類已包含 13個(gè)顏色常量 ? 構(gòu)造方法 ? public Color(int r, int g, int b) ? public Color(float r1, float g1, float b1) 22 繪制圖形 3. 繪制文本 ? 繪制字符串 ? public void drawString(String s, int x, int y) ? 繪制字符 ? public void drawString(char c[], int offset, int number int x, int y) ? 繪制字節(jié) ? public void drawString(byte b[], int offset, int number int x, int y) 23 Applet小程序 import 。 import .*。 public class Exam4_4 extends Applet { public void paint(Graphics g) { Font font1, font2, font3。 font1 = new Font(“Serif”, , 20)。 font2 = new Font(“Monospaced”, +, 24)。 font3 = new Font(“SansSerif”, , 16)。 (font1)。 (“Serif 20 point BOLD”, 30, 20)。 (font2)。 (“Monospaced 24 point BOLD + ITALIC”, 30, 80)。 (font3)。 (“SansSerif 16 point PLAIN”, 30, 50)。 int size = ()。 int style = ()。 String name = ()。 String str = name + “ “ + style + “ “ + size。 (str, 30, 110)。 } } 24 Applet小程序 Html Body Applet code= width=500 height=300 /Applet /Body /Html 25 Applet小程序 import 。 import .*。 public class Exam4_6 extends Applet { Font font1 = new Font(“TimesRoman”, , 25)。 Font font2 = new Font(“Braggadcoio”, , 40)。 public void paint(Graphics g) { String str = “I love Beijing!”。 Color mycolor = new Color(192, 64, 200)。 (font1)。 (mycolor)。 (str, 30, 40)。 Color darker = ()。 (darker)。 (str, 50, 80)。 Color brighter = ()。 (brighter)。 (str, 70, 120)。 (font2)。 ()。 (str, 30, 170)。 ()。 (str, 32, 169)。 } } 26 Applet小程序 Html Body Applet code= width=500 height=300 /Applet /Body /Html 27 繪制圖形 4. 繪制幾何圖形 ? 畫直線 ? void drawLine(int x1, int y1, int x2, int y2) ? 畫矩形 ? void drawRect(int x, int y, int width, int height) ? void fillRect(int x, int y, int width, int height) ? void clearRect(int x, int y, int width, int height) ? void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) ? void draw3DRect(int x, int y, int width, int height, boolean b) ? void fill3DRect(int x, int y, int width, int height, boolean b) 28 繪制圖形 4. 繪制幾何圖形 ? 畫圓弧和橢圓 ? void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) ? void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) ? void drawOval(int x, int y, int width, int height) ? void fillOval(int x, int y, int width, int height) 29 Applet小程序 import 。 import .*。 public class Exam4_8 extends Applet { public void paint(Graphics g) { int x0 =10, y0=20, X=150, Y=80, L, c。 int arc
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
公安備案圖鄂ICP備17016276號(hào)-1