[ java ] in KIDS 글 쓴 이(By): hell (나누구야) 날 짜 (Date): 1997년11월13일(목) 00시44분30초 ROK 제 목(Title): [프로젝트 투 소스] 허잡... --;; 제가 만든 건데요.. 무지 허잡하곡요.. 이곳에 올리신 다른 분들것을 보고 개선된 것을 올리도록 하죠.. -------------------TextUp.java------------ import java.awt.*; import java.applet.*; public class TextUp extends Applet implements Runnable { Thread workThread = null; String _text[] = new String[5]; int xpos; int ypos; int i=0; int pause = 300; booleanclear = true; public void init() { _text[0] = getParam("text1", "?"); _text[1] = getParam("text2", "?"); _text[2] = getParam("text3", "?"); _text[3] = getParam("text4", "?"); _text[4] = getParam("text5", "?"); xpos = 10; ypos = size().height; } public String getParam(String p, String d) { String s = getParameter(p); return s == null ? d: s; } protected void setRandomColor(Graphics g) { g.setColor(new Color((float)Math.random(), (float)Math.random(), (float)Math.random())); } public void paint(Graphics g) { if(--ypos< -50) { ypos = size().height; } for(i=0; i<=4; i++) { setRandomColor(g); g.drawString(_text[i], xpos, ypos + i*20); } } public void start() { workThread = new Thread(this); workThread.start(); } public void run() { while(true) { repaint(); for(i=0;i<10000;i++){ } try { Thread.sleep(pause); } catch(InterruptedException e) {} } } public void update(Graphics g) { if (clear) { super.update(g); } else { paint(g); } } public void stop() { if(workThread != null) { workThread.stop(); } } } -------------------------end -----------------------default.html <HTML> <HEAD> <!-- Generated by Kawa IDE --> <TITLE>Applet title</TITLE> </HEAD> <BODY> <H1>First Heading</H1> <HR> <APPLET CODE=TextUp.class WIDTH=300 HEIGHT=200> <Param name='text1' value='안녕하세요....꾸벅~~'> <Param name='text2' value='저는 나누구야 입니다.--;;'> <Param name='text3' value='저의 보잘것 없는 Applet을 실행 시켜주시다니..'> <Param name='text4' value='무지무지 캄사캄사..'> <Param name='text5' value='그럼..'> </APPLET> <HR> </BODY> </HTML> |