Im new to java applet, but it doesnt seem overly complex yet, but I dont get how to use functions from one class to another.. I thought I knew how but I cant find documentation on it from the sdk docs I downloaded
Anyways, heres the program example, Its kind of a pointless program, but you can see what I am trying to accomplish
I just wana figure out how to return the value from the Function class to the test class
import java.applet.*;
import java.awt.*;
import java.awt.Graphics;
public class test extends Applet {
public void paint(Graphics g, Function function)
{
int x;
x = function.getd(50);
g.drawString("Hello!", x, 25);
}
}
class Function
{
public int getd(int d)
{
int d1;
d1 = d+1;
return d1;
}
}
When I try to run it, I dont get any errors, nothing at all happens *Shrug* if anyone can tell me what Im doing wrong I would be really greatful
Anyways, heres the program example, Its kind of a pointless program, but you can see what I am trying to accomplish
I just wana figure out how to return the value from the Function class to the test class
import java.applet.*;
import java.awt.*;
import java.awt.Graphics;
public class test extends Applet {
public void paint(Graphics g, Function function)
{
int x;
x = function.getd(50);
g.drawString("Hello!", x, 25);
}
}
class Function
{
public int getd(int d)
{
int d1;
d1 = d+1;
return d1;
}
}
When I try to run it, I dont get any errors, nothing at all happens *Shrug* if anyone can tell me what Im doing wrong I would be really greatful