You can have a flag, which is set when ActionListeneris called and in the paint method check this flag andif it is set then call the your method and reset theflag...