Thunthu Ganapathy

Greenhorn
+ Follow
since May 09, 2000
Merit badge: grant badges
For More
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 Thunthu Ganapathy

Thanks to Nirmala and jafar ali. Could anybody be of more dumb than I am?.
Regards,
Thunthu
Oops. Why the HTML codes are not getting displayed?. Am I missing something?.
Thunthu.
23 years ago
Oops. Why the HTML codes are not getting displayed?. Am I missing something?.
Thunthu.
Here is the minimal set of tags that required to run an applet. Test is your class.
<HTML>
<BODY>


<APPLET code="Test" height=500 width=500>
</APPLET>

</BODY></HTML>
Hope this helps.
Thanks,
Thunthu.
Here is the minimal set of tags that required to run an applet. Test is your class.
<HTML>
<BODY>


<APPLET code="Test" height=500 width=500>
</APPLET>

</BODY></HTML>
Hope this helps.
Thanks,
Thunthu.
23 years ago
class Complex1 {
public int real, imaginary;
public Complex1 (int r, int i) {
real = r;
imaginary = i;
}
public Complex1 add(Complex1 c) {
return new Complex1 (real + c.real, imaginary + c.imaginary);
}
void Output() {
System.out.println("Values : " + real+" "+imaginary);
//System.out.println("Values c2: " + c2.real+" "+c2.imaginary);//illegal
//System.out.println("Values c3: " + c3.real+" "+c3.imaginary);//illegal
}
}
class subComplex1 extends Complex1 {
subComplex1 (int r, int i) {
real = r;
imaginary = i;
}
}

class Complex2 {
void useThem() {
Complex1 c1 = new Complex1(1,2);
Complex1 c2 = new Complex1(3,4);
Complex1 c3 = c1.add(c2);
c1.Output();
c2.Output();
//c2.Output();
//double d = c3.real;
}
}
class Client {
public static void main (String args[]) {
Complex2 com2 = new Complex2();
com2.useThem();
}
}
While compiling I am getting an error saying that no Constructor matching Complex() found in class Complex1.
Could anyone explain why cann't I have a constructor for a subclass and the usage?.
Thanks,
Thunthu
Yes. Thanks guys. I just tried in other machine and worked just fine. I guess the problem is with my machine.
Thanks again,
Thunthu
I could compile the following program and While running using appletviewer I get an error message saying I/O exception while reading. Make sure that ListenerTest is a file and is readable.
Here is the program.
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
class MyActionListener implements ActionListener
{
public void actionPerformed (ActionEvent ae) {
System.out.println("Action Performed");
}
}

public class ListenerTest extends Applet {
public void init() {
Button btn = new Button("OK");
MyActionListener listener = new MyActionListener();
btn.addActionListener(listener);
add(btn);
}
}
Could any one throw some light?.
Thanks,
Thunthu
Matt,
Yes. I have included into the init() method and it worked. Thanks a ton.
Thanks,
Thunthu.
23 years ago
I would like to change the font size of a text that I am passing from HTML to an applet.
Here is how I am setting the background and foreground colors.
public void init() {
setBackground(Color.gray);
setForeground(Color.black);
//setFontsize(10);//Is there any object that I make use of?
}
Similarly I want to control the font size also. Examples would be great.
Could any one throw some light on this.
Thanks,
Thunthu
23 years ago
Also would like to add
* All non static nested classes are called inner classes.
Thanks,
Thunthu.
24 years ago
Hi Balakrishna,
Here is what happening with your code.
class wat
{
private static void main(String args[])
{
int i=0;
while((i++)<2)
{
System.out.println(i);
}
}
}
Initial value for i = 0
consider the line i++ < 2
substitute the i value in the expression as follows
i) 0(1) < 2 - put the post increment value in the paranthesis.
condition would be satisfied as 0 < 2 but the i value would get incremented by 1 and so it would print 1. Now i value is 1.
ii) 1(2) < 2 - Now for the second iteration i value would be 1 and the post increment would be 2. So it would print 2.
iii) 2(3) < 2 - would fail and that is the reason why you are getting the output as 1 and 2.
Hope this helps. :-)
Thanks,
Thunthu.

24 years ago
Great Explanation Maha,
Thanks,
Yes. It worked. Thanks a lot to the contributors for your time.
24 years ago
Deleting cache files didn't help me. Any modification to the html file reflects as known. But the sequence
1. Modify my .java file
2. Compile it
3. refresh the browser & deleting the cache didn't help me
Appreciate your suggestion.
Thanks,
24 years ago