another way would depend on what you're drawing too. If it's a JPanel I would do something like this:
JPanel myPanel = new DrawMyPanel();

and below I would have a the DrawMyPanel class

public...