자바로

Similar documents
10장.key

10-Java Applet

歯NetworkKawuiBawuiBo.PDF

<4D F736F F F696E74202D20C1A63236C0E520BED6C7C3B8B428B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

오버라이딩 (Overriding)

Chap12

PowerPoint 프레젠테이션

JMF3_심빈구.PDF

<4D F736F F F696E74202D20C1A63138C0E520C0CCBAA5C6AE20C3B3B8AE28B0ADC0C729205BC8A3C8AF20B8F0B5E55D>

제11장 프로세스와 쓰레드

02 C h a p t e r Java

비긴쿡-자바 00앞부속

PowerPoint 프레젠테이션

public class FlowLayoutPractice extends JFrame { public FlowLayoutPractice() { super("flowlayout Practice"); this. Container contentpane = getcontentp

Microsoft PowerPoint - EEL2 Lecture10 -Swing and Event Handling.pptx

제8장 자바 GUI 프로그래밍 II

Analytics > Log & Crash Search > Unity ios SDK [Deprecated] Log & Crash Unity ios SDK. TOAST SDK. Log & Crash Unity SDK Log & Crash Search. Log & Cras

Contents. 1. PMD ㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍ 2. Metrics ㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍ 3. FindBugs ㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍ 4. ㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍㆍ

JMF2_심빈구.PDF

PowerPoint Presentation

rmi_박준용_final.PDF

Microsoft PowerPoint - ÀÚ¹Ù08Àå-1.ppt

자바GUI실전프로그래밍2_장대원.PDF

5장.key

MasoJava4_Dongbin.PDF

스레드의우선순위 우선순위설정메소드 : void setpriority(int newpriority) newpriority 에설정할수있는등급 : 1( 가장낮은우선순위 ) 부터 10( 가장높은우선순위 ) 가장높은우선순위 : MAX_PRIORITY, 보통우선순위 : NORM_

( )부록

03-JAVA Syntax(2).PDF

3ÆÄÆ®-11

05-class.key

03장.스택.key

Microsoft PowerPoint - java1-lab5-ImageProcessorTestOOP.pptx

스레드를적용하지않은결과와스레드를적용한결과의비교 1) 두개의작업을스레드를사용하지않고수행한예 ) : 순차작업 class ThreadTest2 { System.out.print("-");// 화면에 - 를출력하는작업 System.out.print(" ");// 화면에 를출력

Cluster management software

Modern Javascript

자바-11장N'1-502

PowerPoint 프레젠테이션

OOP 소개

<4D F736F F F696E74202D205B4A415641C7C1B7CEB1D7B7A1B9D65D3130C0E5C0CCBAA5C6AEC3B3B8AE>

歯JavaExceptionHandling.PDF

12-file.key

C프로-3장c03逞풚

PowerPoint 프레젠테이션

09-interface.key

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션

Microsoft PowerPoint - 06-Chapter09-Event.ppt

Microsoft PowerPoint - 04-UDP Programming.ppt

Java ~ Java program: main() class class» public static void main(string args[])» First.java (main class ) /* The first simple program */ public class

14-Servlet

슬라이드 1

rosaec_workshop_talk

01-OOPConcepts(2).PDF

I T C o t e n s P r o v i d e r h t t p : / / w w w. h a n b i t b o o k. c o. k r

Network Programming

Microsoft PowerPoint - 10장

(Microsoft PowerPoint - ETRSRHFRXNAM.ppt [\310\243\310\257 \270\360\265\345])

Microsoft Word - SRA-Series Manual.doc

13ÀåÃß°¡ºÐ

Java

9장.key

PowerPoint Presentation

웹연동 } 웹 (Web) 환경에서데이터베이스시스템을연동하는방법은다음과같다 } Server Client 구조의통신 (2-Tier) } Server Middleware Client 구조의통신 (3-Tier) 2

Microsoft PowerPoint - RMI.ppt

fundamentalOfCommandPattern_calmglow_pattern_jstorm_1.0_f…

Microsoft PowerPoint - Java-03.pptx

Microsoft PowerPoint 자바-기본문법(Ch2).pptx

Microsoft PowerPoint - 14주차 강의자료

Dialog Box 실행파일을 Web에 포함시키는 방법

Ext JS À¥¾ÖÇø®ÄÉÀ̼ǰ³¹ß-³¹Àå.PDF

Microsoft PowerPoint os7.ppt [호환 모드]

Microsoft PowerPoint - java1-lecture10.ppt [호환 모드]

Something that can be seen, touched or otherwise sensed

PowerPoint 프레젠테이션

신림프로그래머_클린코드.key

03장

K&R2 Reference Manual 번역본

Microsoft PowerPoint - 2강

KARAAUTO_4¿ù.qxd-ÀÌÆå.ps, page Normalize

(8) getpi() 함수는정적함수이므로 main() 에서호출할수있다. (9) class Circle private double radius; static final double PI= ; // PI 이름으로 로초기화된정적상수 public

PowerPoint Presentation

(Microsoft PowerPoint - java1-lecture7.ppt [\310\243\310\257 \270\360\265\345])

JavaGeneralProgramming.PDF

Connection 8 22 UniSQLConnection / / 9 3 UniSQL OID SET

< FBFF8B0DDB1B3C0B0BFACBCF6BFF85FBFEEBFB5B4E3B4E7C0DA5FBFF6C5A9BCF35FC0DAB7E1C1FD2D E687770>

DocsPin_Korean.pages

슬라이드 1

쉽게 풀어쓴 C 프로그래밍

MAGIC-6004M_K

untitled

자바네트워킹1.PDF

슬라이드 1

Design Issues

PowerPoint 프레젠테이션


CD-6208_K

Mobile Service > IAP > Android SDK [ ] IAP SDK TOAST SDK. IAP SDK. Android Studio IDE Android SDK Version (API Level 10). Name Reference V

@OneToOne(cascade = = "addr_id") private Addr addr; public Emp(String ename, Addr addr) { this.ename = ename; this.a

<C0CCBCBCBFB52DC1A4B4EBBFF82DBCAEBBE7B3EDB9AE2D D382E687770>

ch09

Transcription:

! from Yongwoo s Park ZIP,,,,,,,??!?, 1,

1 1, 1 (Snow Ball), /,, 5,,,, 3, 3, 5, 7,,,,,,!

,, ZIP, ZIP, images/logojpg : images/imageszip :, backgroundjpg, shadowgif, fallgif, ballgif, sf1gif, sf2gif, sf3gif, sf4gif, asf1gif, asf2gif, asf3gif, asf4gif, asf5gif, asf6gif, asf7gif, asf8gif,, ZIP!, getimage Image, ZIP Image?, SnowCraftjava, getimagesfromzip 1) ZIP URL URL url = new URL(getDocumentBase(), "images/imageszip"); 2) URL, ZIP, ZipInputStream ZipInputStream zipinputstream = new ZipInputStream(new DataInputStream(urlopenStream())); 3) ZipInputStream ZipEntry,, ZipInputStream while((zipentry = zipinputstreamgetnextentry())!= null) { String name = zipentrygetname(); int pos = 0; int bytesread=0; int size = (int)zipentrygetsize(); byte[] buffer = new byte[size]; for(;size>0;size-=bytesread) { bytesread = zipinputstreamread(buffer, pos, size); pos += bytesread; /* 4) */

4), Toolkit, ZipEntry (1) 3) while((zipentry = zipinputstreamgetnextentry())!= null) { String name = zipentrygetname(); /* 3) */ if("backgroundjpg"equals(name)) { bg = tkcreateimage(buffer); else if("shadowgif"equals(name)) { shadow = tkcreateimage(buffer); else if("fallgif"equals(name)) { burst = tkcreateimage(buffer); else if("ballgif"equals(name)) { ball = tkcreateimage(buffer); else { /* sf1gif ~ sf4gif, asf1gif ~ asf8gif */ 5), MediaTracker Image getimagesfromzip(); trackeraddimage(bg, 0); trackeraddimage(ball, 1); trackeraddimage(shadow, 1); trackeraddimage(burst, 1); for(int i=0;i<images1length;i++) { trackeraddimage(images1[i], 2); for(int i=0;i<images2length;i++) { trackeraddimage(images2[i], 2); try { trackerwaitforall(); catch(exception exception1) {, Toolkit createimage Image ZIP, AudioClip,,

,,,,,, ImageCanvas :, Canvas Jr 8 TimeBar :, Canvas Jr 8 LoadingBarWindow : ImageCanvas TimeBar, Dialog modal,, < 1> SnowCraftjava, init, loadimages, getimagesfromzip, loadsounds, getaudioclip < 1> public class SnowCraft extends Applet implements Runnable, MouseListener, MouseMotionListener { LoadingBarWindow loadingbarwindow=null; int loadingbarcount = 0; public void init() { logoimage = getimage(getdocumentbase(), "images/logojpg"); // LoadingBarWindow loadingbarwindow = new LoadingBarWindow((Frame)thisgetParent(), logoimage, "loading images"); loadingbarwindowshow(); // loadingbarwindowsetmessage("loading images") ; // loadingbarwindowsetstatuslevel(0 ); // 0

loadimages(); // loadingbarwindowsetmessage("loading sounds"); // loadingbarwindowsetstatuslevel(0 ); // 0 loadsounds(); // loadingbarwindowdispose(); // private void getimagesfromzip() { try { while((zipentry = zipinputstreamgetnextentry())!= null) { loadingbarcount++; int level = (int)(((double)loadingbarcount/160)*1000) ; // loadingbarwindowsetstatuslevel(level); // catch(exception anyexception) { anyexceptionprintstacktrace(); private void loadimages() { public AudioClip getaudioclip(url url, String name) { AudioClip clip = supergetaudioclip(url, name); clipplay(); // play int level = (int)(((double)(++loadingbarcount) /110) * 1000) ; // loadingbarwindowsetstatuslevel(level) ); // clipstop(); // return(clip); private void loadsounds() { loadingbarcount = 0; //

audioclip = getaudioclip(getcodebase(), "audio/audioclipau"); levelclip = getaudioclip(getcodebase(), "audio/levelclipau"); /* */ loadingbarwindowsetstatuslevel(100);,, 2,,!, update,,,,

,, Component, repaint,, repaint, Repaint() : update(graphics g) update(graphics g) : update, paint(graphics g) paint(graphics g) :, update, update public void update(graphics g) { paint(g);,,,,,,,,,, (double-buffering) 3,,,,

Image Image Buffer Buffer Screen Screen Draw Switch offgraphics g 3,, << 2> < 2> public class SnowCraft extends Applet implements Runnable, MouseListener, MouseMotionListener { int[] type = new int[] { CursorCROSSHAIR_CURSOR ; Cursor cursor=null; Image bufferimage=null; Graphics buffergraphics=null; Thread manmovethread, ballmovethread, computeractionthread; public void init() { // CROSSHAIR (+) cursor = CursorgetPredefinedCursor(type[0]); thissetcursor(cursor); /* */ // bufferimage = createimage(thissize()width, thissize()height); buffergraphics = bufferimagegetgraphics(); public void run() { Thread currentthread=null; while(true) {

if(status[who] == 1 && power < 50) { //, power++; currentthread = ThreadcurrentThread(); if(currentthread == displaythread) { try { Threadsleep(DISPLAY_DELAY); catch(interruptedexception e) { ; showstatus(etostring()); // repaint(); else if(currentthread == computeractionthread) { try { Threadsleep(DISPLAY_COMPUTING); catch(interruptedexception e) { ; showstatus(etostring()); //, computeraction(); // public void tranject(int dirx, int diry, int dirz, int ith) { /*,, */ public void atranject(int adirx, int adiry, int adirz, int aith) { /*,, */ public void commove(int i) { /*, */

public void comthrow(int i) { /* */ public void computeraction() { for(int i=0;i<ams;i++) { if(astatus[i]!= 6 && astatus[i]!= 7) { if(aicom[i] == 0) { aicom[i] =(int)(mathrandom()*5); switch(aicom[i]) { case 0 : break; case 1 : commove(i); break; case 2 : comthrow(i); break; case 3 : commove(i); break; case 4 : comthrow(i); break; else if(astatus[i] == 6) { if(agetup[i]++ == 10) { agetup[i] = 0; astatus[i] = 0; public void ballxyz() { /*, */ // public void showall(graphics g) { buffergraphicsdrawimage(bg, 0, 0, this); for(int j=0;j<ms;j++) { if(j!= who) { buffergraphicsdrawimage(images1[status[j]], xpos[j], ypos[j], this); tempx[j]=xpos[j]; tempy[j]=ypos[j]; buffergraphicsdrawimage(images1[status[who]], xpos[who], ypos[who], this); /* */

public void initgame(graphics g) { int i, cx=400, cy=30; buffergraphicsdrawimage(bg, 0, 0, this); first = false; for(int j=0;j<ms;j++) { xpos[j] = 300+(int)(Mathrandom()*230); ypos[j] = 160+(int)(Mathrandom()*110); buffergraphicsdrawimage(images1[status[j]], xpos[j], ypos[j], this); try { Threadsleep(1000); catch(interruptedexception e) { showstatus(etostring()); ; /* */ public void update(graphics g) { paint(g); public void paint(graphics g) { if(first == true) { initgame(g); // showall(g); // ballxyz(); gdrawimage(bufferimage, 0, 0, this); // 12

: AIFF, AU, WAV : MIDI TYPE 0, MIDI TYPE 1, RMF 8kHz 48khz (sample rate) 8 16 (mono) (stereo),, 8, AudioClip,,, << 3> < 3> public class SnowCraft extends Applet implements Runnable, MouseListener, MouseMotionListener { AudioClip audioclip, levelclip, strikeclip, astrikeclip, endclip, notcomeclip, shootclip; AudioClip deadclip, adeadclip, dropclip, ashootclip; public void init() { loadsounds(); public AudioClip getaudioclip(url url, String name) { AudioClip clip = supergetaudioclip(url, name); clipplay(); // play int level = (int)(((double)(++loadingbarcount) / (double)11) * (double)100); loadingbarwindowsetstatuslevel(level); clipstop(); // return(clip); private void loadsounds() { audioclip = getaudioclip(getcodebase(), "audio/audioclipau"); /* */

public void start() { // /, if(audioclip!= null) { audiocliploop(); public void stop() { //, if(audioclip!= null) audioclipstop(); /* */ public void tranject(int dirx, int diry, int dirz, int ith) { //, if(shootclip!= null) { shootclipplay(); // public void atranject(int adirx, int adiry, int adirz, int aith) { if(ashootclip!= null) { ashootclipplay(); // public void gameover() { if(endclip!= null) { endclipplay(); // stop(); //

, (stop) HTML,, stop,,,,,,,,,,,, MouseListener MouseListener, MouseAdapter MouseListener MouseAdapter, void mouseclicked(mouseevent e): void mouseentered(mouseevent e): void mouseexited(mouseevent e):

void mousepressed(mouseevent e): void mousereleased(mouseevent e):,, < 4> < 4> public class SnowCraft extends Applet implements Runnable, MouseListener, MouseMotionListener { public void init() { addmouselistener(this); addmousemotionlistener(this); public void mousepressed(mouseevent e) { int x = egetx(); int y = egety(); for(int i=0;i<ms;i++) { if(status[i]!= 3) { dx = x - xpos[i]; dy = y - ypos[i]; if(dx < width && dx >= 0 && dy < height && dy >= 0) { status[i] = 1; who = i; break; public void run() { while(true) { if(status[who] == 1 && power < 50) { power++;

public void mousereleased(mouseevent e) { if(status[who]!= 3 && dx<width && dx>=0 && dy<height && dy>=0) { vxaddelement(new Integer(xpos[who]+5)); vyaddelement(new Integer(ypos[who]+10)); vzaddelement(new Integer(power/2)); status[who] = 2; power = 0; public void mouseclicked(mouseevent e) { public void mouseentered(mouseevent e) { public void mouseexited(mouseevent e) {, (mousepressed), (MS=3), (x, y) (xpos [i], ypos[i]) 0 (width, height),, status[i] 1, (i ) who, (x,y) (xpos[i], ypos[i]) (dx, dy),, who status [who], (power),, status[who] 1 (poser),, (mousereleased), vx, vy, vz (x+5,y+10) (power/2), status[who] 2 (power) 0 vx, vy, vz, MouseMotionListener MouseMotionListener, MouseMotionAdapter MouseMotionListener MouseMotionAdapter,

void mousedragged(mouseevent e): void mousemoved(mouseevent e):,, < 5 < 5> public class SnowCraft extends Applet implements Runnable, MouseListener, MouseMotionListener { public void init() { addmouselistener(this); addmousemotionlistener(this); public void mousedragged(mouseevent e) { if(status[who]!= 3) { int x = egetx(); int y = egety(); if((x+y) <= 400) { // if(notcomeclip!= null) { notcomeclipplay(); if(((x+y) > 400) && dx<width && dx >= 0 && dy < height && dy >= 0 && x < 582 && y < 312) { xpos[who] = x - dx; ypos[who] = y - dy; status[who] = 1; public void mousemoved(mouseevent e) {

, (x,y), x y 400!,, (mousepressed), (dx,dy) dx = x xpos[i] dy = y ypos[i], xpos[i] = x dx ypos[i] = y - dy,,,, ZIP,,, loginasp,, ScoreBoardasp, HTML,,, ~