Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!

usman ahmad

Ranch Hand
+ Follow
since Mar 06, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by usman ahmad

Hi,
I would also like to get a answer for this.
Thanks.
17 years ago
submitted 1a 2nd attempt.
Usman
19 years ago
Subodh is the html file in the same dir as the applet. Check that and let me know!
Regards,
Usman
19 years ago
Hi! I will be trying this soon.
Thanks
Regards,
Usman
19 years ago
I have posted my code to nitpick. And Sorry about posting my code here.
check it.
Usman

[This message has been edited by usman ahmad (edited March 28, 2001).]
[This message has been edited by usman ahmad (edited March 28, 2001).]
[This message has been edited by usman ahmad (edited March 28, 2001).]
19 years ago
This is an EXCELLENT Explanation.
thanks a TON!
Usman
19 years ago
Thanks Nate, But shouldn't it then not display when I view it in the browser on my computer. But I can see it. Anyways, show me the code with which I can do that.
Thanks!
Regards,
Usman
19 years ago
Here is the code that subodh wrote.But he keeps changing places.
// use parameters
import java.awt.*;
import java.applet.*;
/*
<applet code="ParamDemo" width=300 height=80>
<param name=fontName value=Courier>
<param name=fontSize value=14>
<param name=leading value=2>
param name=accountEnabled value=true>
</applet>
*/
public class ParamDemo extends Applet
{
String fontName;
int fontSize;
float leading;
boolean active;
//Initialize the string to be displayed
public void start()
{
String param;
fontName = getParameter("fontName");
if(fontName == null)
fontName = "Not Found";
param = getParameter("fontSize");
try
{
if(param != null) // if not found
fontSize = Integer.parseInt(param);
else
fontSize = 0;
}
catch(NumberFormatException e)
{
fontSize = -1;
}
param = getParameter("leading");
try{
if (param != null) // if not found
leading = Float.valueOf(param).floatValue();
else
leading = 0;
} catch(NumberFormatException e){
leading = -1;
}
param = getParameter("accountEnabled");
if (param != null)
active = Boolean.valueOf(param).booleanValue();
}
// Display parameters
public void paint(Graphics g) {
g.drawString("Font name: " + fontName, 0, 10);
g.drawString("Font size: " + fontSize, 0, 26);
g.drawString("Leading: " + leading, 0, 42);
g.drawString("Account Active: " + active, 0, 58);
}
}
and you can check it here to see how it is working http://www.angelfire.com/yt2/resume1/PD.htm
Regards,
Usman

[This message has been edited by usman ahmad (edited March 28, 2001).]
[This message has been edited by usman ahmad (edited March 28, 2001).]
19 years ago

OR

In the paint() method you can use like this
<pre>
public void paint(Graphics g)
{
setbackground(Color.anycolor);
}
</pre>
Where anycolor can be white,red,blue etc.
I hope this will be helful too.
Regards,
Usman
19 years ago
Thanks Both of you!!
Regards,
Usman
19 years ago
I'll tell you about paint()
When you change a drawing in an applet, you call the repaint() method to repaint the applet surface. The repaint() method calls the update() method. The update() method clears the viewing area and calls the paint() method, which contains the drawing instructions.
I hope this is helpful
Regards,
Usman
19 years ago
Hi! What now I did is explicitly called the img.
you can check it here
http://www.angelfire.com/resume1/testthread.htm
But the image still won't run in the applet.
Any help!
Regards
Usman
19 years ago
This is one Big nested loop. Siva could you please elaborate a bit more so that I can also understand fully.Thanks a lot.
regards
Usman
19 years ago
Hi!
sometimes a variable or a datafield should be constant i.e. it should not change during the execution of a programme.For example:
The value for a company id is fixed, so you do not want any methods to alter the company id value while a programme is running. To prevent alteration, insert the key word "final" in the company id variable declaration so the name
COMPANY_ID becomes a symbolic constant, which indicates that when you compile any program that uses an object that contains the COMPANY_ID, the field has a final, unalterable value.
You cannot change the value of a symbolic constant after declaring it, any attempt to do so will result in a compile time error.
the class java.lang.Math contains constants and methods that you can use to perform common mathematical functions.
As described by Cindy,
public final static double PI = 3.14159265358979323846;
NOTICE that PI is
1)public ,so any program can access it directly.
2)final, so it cannot be changed
3)static, so only one copy exists
4)double, so it holds a large floating point value.
I hope this is helpful.
Regards
Usman
19 years ago
Tried this also but the image part is missing still.
Thanks anyways!
Regards
Usman
19 years ago