-
t1
the applet does not run. all i get is a message saying "applet not initialised".
/* < applet code="T1" width=200 height = 100 >
* < PARAM NAME = fontsize VALUE = 30 >
* < PARAM NAME = message VALUE = hello >
* < /applet > */
import java.awt.*;
import java.applet.*;
public class T1 extends Applet {
Image myimage;
Graphics myGC1;
Graphics myGC2;
int sizex = 150;
int sizey = 80;
int Serif_Fontsize;
String Serif_String;
public void paint(Graphics g) {
g.drawImage(myimage,0,0,this);
}
public void init() {
Serif_Fontsize = Integer.parseInt(getParameter("fontsize"));
Serif_String = getParameter("message");
myimage = createImage(sizex,sizey);
myGC1 = myimage.getGraphics();
myGC2 = myimage.getGraphics();
/* 12 point MonoSpaced bold font */
myGC1.setFont(new Font("MonoSpaced",Font.BOLD,12));
/* Serif_Fontsize point Serif font */
myGC2.setFont(new Font("Serif",Font.PLAIN,Serif_Fontsize));
myGC1.setColor(Color.blue);
myGC2.setColor(Color.red);
myGC1.drawString("Hi there",10,20);
myGC2.drawString(Serif_String,10,60);
myGC1.drawRect(100,20,30,10);
myGC2.fillRect(100,60,30,10);
repaint();
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks