//
/* ---------------------------------------------------------------------------------------------- connectivity.java 世界に広がるインターネット ver. 1.00 (JDK 1.02) ueyama@infonet.co.jp 2009.08.08 ---------------------------------------------------------------------------------------------- */ import java.applet.Applet; import java.awt.*; public class connectivity extends Applet { int V=0; // 地図 No. Image Img; public void init() { String bg=getParameter("bgcolor"); // 背景色の読み込み int bgc=Integer.valueOf(bg,16).intValue(); setBackground(new Color(bgc)); MediaTracker mt=new MediaTracker(this); Img=getImage(getCodeBase(), getParameter("figure")); // gif ファイルの読み込み mt.addImage(Img, 0); try { mt.waitForID(0); } catch(InterruptedException e){}; } public boolean inside(int x, int a, int b) { return (x<=Math.max(a,b) && x>=Math.min(a,b)) ? true:false; } public void dsp_p(int x, int y, int m, int n, int c) // 図や文字を描く { Graphics gx=getGraphics(); int w=0, h=0, ox=0, oy=0; switch(c) { case 0: w=531; h=371; ox= 0; oy= 0; break; // 地図 case 1: w= 23; h= 22; ox= 0; oy=4823; break; // 番号 case 2: w=123; h= 22; ox= 23; oy=4823; break; // 年月 case 3: w= 23; h= 22; ox=146; oy=4823; break; // ボタン case 4: w= 23; h= 29; ox=238; oy=4823; break; // 早送りボタン } gx.clipRect(x,y,w,h); gx.clearRect(x,y,w,h); gx.drawImage(Img,x-(ox+m*w),y-(oy+n*h),this); gx.dispose(); } public void dsp_btn(int c) // ボタン等の表示 { int n[]={0,0,0,0,0}; n[c]=1; dsp_p(0,0,0,V,2); // 年月の表示 dsp_p(550+n[1], 40+n[1],(V==0)?1:0,0,4); // 早戻りボタン 〃 dsp_p(550+n[2], 80+n[2],(V==0)?1:0,0,3); // 戻るボタン 〃 dsp_p(549,114,0,V,1); // 番号 〃 dsp_p(550+n[3],145+n[3],(V==12)?3:2,0,3); // 送りボタン 〃 dsp_p(550+n[4],175+n[4],(V==12)?3:2,0,4); // 早送りボタン 〃 } public void paint(Graphics g) { g.clearRect(0,0,size().width,size().height); g.drawRect(0,40,532,372); // 地図枠の表示 dsp_p(1,41,0,V,0); // 地図の表示 dsp_btn(0); // ボタン等の表示 } public boolean mouseDown(Event e, int x, int y) { if(x>550 && inside(y,40,204)) { if(inside(y,40,70) && V>0) // 早戻りボタンが押された { V=0; dsp_btn(1); // ボタンの表示 } if(inside(y,80,102) && V>0) // 早るボタンが押された { V--; dsp_btn(2); // ボタンの表示 } if(inside(y,145,167) && V<12) // 送りボタンが押された { V++; dsp_btn(3); // ボタンの表示 } if(inside(y,175,204) && V<12) // 早送りボタンが押された { V=12; dsp_btn(4); // ボタンの表示 } dsp_p(1,41,0,V,0); // 地図の表示 } return true; } public boolean mouseUp(Event e, int x, int y) { if(x>550 && inside(y,40,204)) dsp_btn(0); // ボタンの表示 return true; } } //戻る