I need to pass the grapics object 'g' to the action method from the paint method. Something like this:
public boolean action(Event event, Object obj)
{
Graphics g=getGraphics();
repaint();
if (event.target == choice)
String selection = choice.getSelectedItem();
if (selection.equals("do something"))
{
doSomething(g);
repaint();
}
else if (selection.equals("do something else"))
{
Somethingelse(g);
repaint();
}
return(true);
}
else
return(false);
}
I tried to declare g as a global graphics variable but it doesnt work. Is there another way to do this. Any help is appreciated .. Thanks..