-
Code:
public class Applet1 extends Applet
{
public String i_item;
/**
* The entry point for the applet.
*/
public void init()
{
xitem = new Class1(i_item);
}
public void paint(Graphics g) {
}
}
Ok, i want to be able to call the xitem in the paint sub. Sorry this is a basic question but this is my 3rd day doing this hehe :)
Anyways, i want to make it so i can do
Code:
public void paint(Graphics g) {
xitem.Draw();
{
But the thing is, when i put in xitem. the submenu wont pop up. It should have Draw inside because my Class1 has it. This is what it looks like.
Code:
import java.awt.*;
public class Class1
{
String x_item;
public Class1(String x){
x_item = x;
}
public void DrawX(Graphics d){
d.drawString(x_item,20,20);
}
}
I know there are many errors, but what am i forgeting to make xitem equal to... i tried making it
public xitem Class1;
before the init void but that dosent work.
??? Please help, im stuck damnit! :\
-
How about:
Code:
public class Applet1 extends Applet {
private String m_xitem;
public init(String x_item) {
m_xitem = x_item;
}
public void paint(Graphics g) {
g.drawString(m_xitem, 5, 50);
}
}
You'd need to use a different way of setting m_xitem, though, such as: getParameter("string"), which is set in the <applet> tag.
-
Ahhhhhhh.... now i see it! Thanks for the post! Ill go play around with it right now!