import java.awt.*; import java.applet.*; import java.net.*; import java.lang.*; import java.awt.image.MemoryImageSource; public class smheader extends Applet { int x=0,y=0,StrPosX,StrPosY,picw=640,pich=100; Color White; Font MyFont; Image img; FontMetrics Fo; String ButtonText,Imagepath; URL url; public void init() { White = new Color(255,255,255); setBackground(White); ButtonText = getParameter("text"); Imagepath = getParameter ("imagepath"); try { url = new URL(Imagepath); } catch (Exception MalformedURLException) { ; } MyFont = new Font("Helvetica",Font.BOLD,36); img = getImage(url); } public void paint(Graphics g) { // text area is 470 by 70 from lower left corner of 640 by 100 picture // 65 = 100-70+70/2 Fo = g.getFontMetrics(MyFont); StrPosX = (470 - Fo.stringWidth(ButtonText))/2; StrPosY = 72; g.drawImage(img,x,y,picw,pich,this); g.setFont(MyFont); g.setColor(White); g.drawString(ButtonText,StrPosX,StrPosY); } public void update(Graphics g) { paint(g); } public void start() { init(); for(int k=0;k<20;k++) System.out.println("At " + k + " netscape's bug!"); repaint(); } public boolean mouseEnter(Event e, int posx, int posy) { getAppletContext().showStatus(ButtonText); repaint(); return false; } public boolean mouseMove(Event e, int posx, int posy) { getAppletContext().showStatus(ButtonText); return false; } }