version 1.1, 1999/11/29 19:44:21
|
version 1.2, 2000/03/16 18:52:07
|
Line 5
|
Line 5
|
<CENTER> |
<CENTER> |
|
|
<APPLET CODE=GLabel.class CODEBASE=JAVA/Class width=550 height=304> |
<APPLET CODE=GLabel.class CODEBASE=JAVA/Class width=550 height=304> |
<PARAM NAME="BGIMG" VALUE="path/to/D.gif"> |
<PARAM NAME="BGIMG" VALUE="path/to/background.gif"> |
<PARAM NAME="GRID" VALUE="10"> |
<PARAM NAME="GRID" VALUE="10"> |
<PARAM NAME="COUNT" VALUE="7"> |
<PARAM NAME="COUNT" VALUE="7"> |
<PARAM NAME="LB0" VALUE="X"> |
<PARAM NAME="LB0" VALUE="X"> |
Line 29
|
Line 29
|
<PARAM NAME="LB6" VALUE="7"> |
<PARAM NAME="LB6" VALUE="7"> |
<PARAM NAME="X6" VALUE="49"> |
<PARAM NAME="X6" VALUE="49"> |
<PARAM NAME="Y6" VALUE="106"> |
<PARAM NAME="Y6" VALUE="106"> |
|
<PARAM NAME="ICOUNT" VALUE="2"> |
|
<PARAM NAME="IMG0" VALUE="path/to/image0.gif"> |
|
<PARAM NAME="IX0" VALUE="106"> |
|
<PARAM NAME="IY0" VALUE="106"> |
|
<PARAM NAME="IMG1" VALUE="path/to/image1.gif"> |
|
<PARAM NAME="IX1" VALUE="106"> |
|
<PARAM NAME="IY1" VALUE="106"> |
</APPLET> |
</APPLET> |
|
|
</CENTER> |
</CENTER> |
Line 63 public class GLabel extends Applet imple
|
Line 70 public class GLabel extends Applet imple
|
public int Xcord[]; |
public int Xcord[]; |
public int Ycord[]; |
public int Ycord[]; |
public String sLabel[]; |
public String sLabel[]; |
|
public Image iImg[]; |
|
public int iX[]; |
|
public int iY[]; |
|
|
public int label_cnt; |
public int label_cnt; |
|
public int img_cnt; |
public int fsize; |
public int fsize; |
public int show_grid; |
public int show_grid; |
public int grid_ww; |
public int grid_ww; |
Line 78 public void init()
|
Line 90 public void init()
|
|
|
Xcord = new int[64]; Ycord = new int[64]; |
Xcord = new int[64]; Ycord = new int[64]; |
sLabel = new String[64]; |
sLabel = new String[64]; |
|
iImg = new Image[64]; |
|
iX = new int[64]; iY = new int[64]; |
|
|
show_grid = 0; |
show_grid = 0; |
f16 = new Font("TimesRoman",Font.PLAIN,16); |
f16 = new Font("TimesRoman",Font.PLAIN,16); |
|
|
Line 95 public void init()
|
Line 110 public void init()
|
Ycord[idx]=(p==null)?30:Integer.valueOf(p).intValue(); |
Ycord[idx]=(p==null)?30:Integer.valueOf(p).intValue(); |
// System.out.println("X= "+Xcord[idx]+" Y= "+Ycord[idx]+" L= "+sLabel[idx]); |
// System.out.println("X= "+Xcord[idx]+" Y= "+Ycord[idx]+" L= "+sLabel[idx]); |
} |
} |
|
|
|
p=getParameter("ICOUNT"); |
|
img_cnt=(p==null)?1:Integer.valueOf(p).intValue(); |
|
for(idx=0;idx<img_cnt;idx++){ |
|
q = "IMG" + idx; |
|
p = getParameter(q); |
|
if(p != null) { |
|
try { |
|
System.out.print("URL=" + p + "\n"); |
|
f_url = new URL(p); |
|
} |
|
catch (MalformedURLException exc) { |
|
System.out.print("Malformed URL=" + p + "\n"); |
|
} |
|
iImg[idx] = getImage(f_url); |
|
} |
|
q = "IX" + idx; |
|
p = getParameter(q); |
|
iX[idx]=(p==null)?20:Integer.valueOf(p).intValue(); |
|
q = "IY" + idx; |
|
p = getParameter(q); |
|
iY[idx]=(p==null)?30:Integer.valueOf(p).intValue(); |
|
// System.out.println("X= "+Xcord[idx]+" Y= "+Ycord[idx]+" L= "+sLabel[idx]); |
|
} |
|
|
|
|
|
|
p=getParameter("BGIMG"); |
p=getParameter("BGIMG"); |
if(p != null) { |
if(p != null) { |
try { |
try { |
Line 119 public void init()
|
Line 161 public void init()
|
public void paint(Graphics g) |
public void paint(Graphics g) |
{ |
{ |
int idx; |
int idx; |
Dimension d = size(); |
Dimension d = getSize(); |
int appw = d.width; |
int appw = d.width; |
int apph = d.height; |
int apph = d.height; |
int x1,y1,x2,y2; |
int x1,y1,x2,y2; |
Line 131 public void paint(Graphics g)
|
Line 173 public void paint(Graphics g)
|
g.setColor(Color.white); |
g.setColor(Color.white); |
g.fillRect(0, 0, appw, apph); |
g.fillRect(0, 0, appw, apph); |
} |
} |
|
|
|
for(idx=0;idx<img_cnt;idx++){ |
|
if( iImg[idx] != null ) { |
|
g.drawImage(iImg[idx], iX[idx],iY[idx], this); |
|
} else { |
|
g.setColor(Color.white); |
|
g.fillRect(iX[idx], iY[idx], appw, apph); |
|
} |
|
} |
|
|
|
|
|
|
g.setColor(Color.black); |
g.setColor(Color.black); |
for(idx=0;idx<label_cnt;idx++){ |
for(idx=0;idx<label_cnt;idx++){ |
g.drawString(sLabel[idx],Xcord[idx],Ycord[idx]); |
g.drawString(sLabel[idx],Xcord[idx],Ycord[idx]); |